Count dates in one chart with PowerPivot. - excel

I am trying to do some analysis with MS Excel PowerPivot. I have a table, let's call it tb_policies. This table has the columns start_date and end_date and
I need a single chart that shows the count of started AND ended policies for a period of time.
One chart for the count of started and one for the ended policies (maybe grouped by month) is no problem. But how can I bring then together in one without losing the pivot-opportunities (like dynamic filtering etc)?

#Soulus101 The dates are only in tb_policies. It looks like this:
Image_tb_policies
The grath I want to create is "count of started policies" vs. "count of ended policies"
Like this:
Image_chart
(Sorry, its not allowed to me to post inline images)

Related

Spotfire- limiting Information link colum expression

I have a column of data [Sales ID] that bringing in duplicate data for an analysis. My goal is to try and limit the data to pull unique sales ID's for the max day of every month in the analysis only (instead of daily). Im basically trying to get it to only pull in unique sales ID values for the last the day of every month in the analysis ,and if the current day is the last day so far then it should pull that in. So it should pull in the MAX date in any given month. Please how do i write an expresion with the [Sales ID] column and [Date ] column to acieve this?
Probably the two easiest options are to
1) Adjust the SQL as niko mentioned
2) Limit the visualization with the "Limit Data Using Expression" option, using the following:
Rank(Day([DATE]), "desc", Month([DATE]), Year([DATE])) = 1
If you had to do it in the Data on Demand section (maybe the IL itself is a usp or you don't have permission to edit it), my preference would be to create another data table that only has the max dates for each month, and then filter your first data table by that.
However, if you really need to do it in the Data on Demand section, then I'm guessing you don't have the ability to create your own information links. This would mean you can't key off additional data tables, and you're probably going to have to get creative.
Constraints of creativity include needing to know the "rules" of your data -- are you pulling the data in daily? Once a week? Do you have today's data, or today - 2? You could probably write a python script to grab the last day of every month for the last 10 years, and then whatever yesterday's date was, and throw all those values into a document property. This would allow you to do a "Values from Property".
(Side Note: I want to say you could also do it directly in the expression portion with something like an extremely long
Date(DateTimeNow()),DateAdd("dd",-1,Date(Year(DateTimeNow()), Month(DateTimeNow()), 1))
But Spotfire is refusing to accept that as multiple values. Interestingly, when I pull the logic for a StringList property, it gives this: $map("${udDates}", ","), which suggests commas are an accurate methodology, but I get an error reading "Expected 'End of expression' but found ','" . Uncertain if this is a Spotfire issue, or related to my database connection)
tl;dr -- Doing it in the Data on Demand section is probably convoluted. Recommend adjusting in SQL if possible, and otherwise limiting in the visualization

Index Match SumIF Problems

I'm trying to create a formula that sums student attendance by week, based on the students ID number. Basically, I want it to look up the student ID, and then output the sum of attendance for certain weeks. This is what I came up with, but it's not working correctly. I'll also need this for each month.
=sumifs(index(Attendance!$A:$Z,MATCH('Attendance by Week'!A5,Attendance!$A:$A,0),0), Attendance!$F$6:$Z$6,Attendance!$F$4:$Z$4,">=" &'Attendance by Week'!F$4,Attendance!$F$4:$Z$4,"<"&'Attendance by Week'!F$4+7)
Attendance by Week Worksheet:
The dates are the start of the week (every Sunday)
Attendance Worksheet:
Each "1" means the student was present
Any Help is appreciated!
For this type of challenge I would skip formulas completely, and go with a PivotTable-based solution because not only do they aggregate things without the need for complex formulas but they also let you group things by numbers of days.
The only barrier you have is that your data is currently as a crosstab, and PivotTables don't like 'em. So you'd need to either change the data entry layout to a flat file i.e. this:
...or use one of the methods I outline at convert cross table to list to make pivot table to turn your crosstab into a flat file. (I used PowerQuery, which is built in to Excel 2016 or later and available as a free addin for Excel 2010 or 2013).
But once you've done that, you can then create a PivotTable that automatically does all that grouping and summing, like so:
...using the Grouping feature:

PowerPivot table relationship not working, repeating totals

Longtime answer-seeker, first time question-asker here so I'm open to feedback about how I'm asking as well. I'm relatively new to Excel's PowerPivot but feel like I have a handle on it for the most part.
I am using PowerPivot for Excel 2010. I have data that I only receive weekly totals for and I use the monday of that week as my primary key in the table I call 'WeeklyTracking'. I create a relationship from that to my Date Table so that I can filter/analyze by month, year, etc. I get no error when I make that relationship, it is a one to many ( I checked for duplicates in my WeeklyTracking table), and it is showing as 'active'.
However, when I go to create a pivot table it's not separating the data by my Date Table fields. It simply repeats the total for the column. What my pivot table shows me. Table Relationships
I tired disconnecting all other table relationships, and I even tried converting dates to numeric values and linking those but to no avail. When I choose to make column labels the date within the 'WeeklyTracking' table it separates out by date just fine which leads me to believe it has to do with the relationship. But I did something very similar with data I get monthly and didn't have any problems so I can't figure out what's different.
Any ideas?
EDIT: It's actually not working for my monthly report either, upon closer inspection. But still I dont understand why not--There's a primary key in each table...
UPDATE: Tried creating a ID number using a formula for each week and creating the relationship on that and it didn't work either.

Calculating the difference between the count of two date fields

I have data that is provided to me that includes the routed date and the service restoration date. From that it's pretty easy to generate a pivot table that generates a table with the date of the month, then a count of received tickets (routed), and the count of closed tickets. I'm trying to generate a calculated field (Pivot -> Options -> Fields, Items & Sets -> Calculated Field) to derive the delta.
When I use =Received - Closed, I get the difference in date rather than the delta in the counts. Can anyone point me in a direction on how I may calculate it? If it was static content it would be easy peasy, but I'm not getting the knack of doing this with a pivot table. Also I could achieve something similar with a countif type command and run it from a static calendar type table (which is what I'll probably end up doing if this ends up being a dead end).
As a solution, you can copy the pivot table and paste it as values in the new sheet. Do you math on values instead of on pivot.
I don't know if formatting your results in the pivot as NUMBER would help.. But you can try that as well.
I was unable to determine a way outside of what was mentioned above by Andrew. I've set up a static date list for the calendar month and then use a series of countifs instead of a pivot table to generate the output. Thanks to all who reviewed the question and to Andrew for his responses.

How do I stop one pivot table from affecting a chart created from a different pivot table?

I am working on processing average CPU loads on some of my servers in Excel 2013. I have my raw data in a table named RawData which contains the CPU load and a timestamp in each row. From RawData I created two pivot tables (loadDaily and loadHourly). In loadDaily, I set the timestamp as a row lable, and set it to group by Days, Hours, Minutes and created a nice chart of my CPU load from it. Now the problem I am having is when I try to group the timestamp field in loadHourly by Hours only, it also applies the grouping to my other pivot table (loadDaily) and my pivot chart linked to that. How do I make the grouping on the timestamp field only apply to loadHourly?
Okay, I answered my own question after toying with it some more. I noticed that after creating my initial groups, in the Pivot Table field list there were new fields (Hours and Days). In my second table, instead of adding the raw timestamp field to it I found out I can use the Hours field that was created when I made my group for the first time.

Resources