doitypeithere
New Member
- Joined
- Mar 19, 2015
- Messages
- 3
Thanks for clicking! I've searched the forum for similar issues and came up with nada. A few posts are close and I feel like this problems should be solvable, but I've been banging my head against a wall for three days on this and (surprise!) I'm getting quite frustrated with Powerpivot. I've been using PP off and on for the last two years and have about a dozen successful, albeit simple, reporting projects under my belt. I'm no expert by any means, but I feel like I at least have a clue with what I'm about . After this week, I'm not so sure anymore.
The situation
I'm working on a reporting project that pulls customer data from an external solution I cannot change. I'm crunching the data in Excel/PowerPivot 2013. In my external source, the data is being collected as rows with the following relevant columns:
[Program Name] - [Program Start Date] - [Program End Date] - [Total $ Spent on Program]
My task is to break the [Total $$$ Spend on Program] field into a [Daily $ Spent on Program] number and then roll it up into fiscal quarters and fiscal years.
The somewhat successful solution
The calculated columns & formulas look something like this:
[Program Duration] = calculate(countrows('Dates'), datesbetween('dates'[DateKey],[Program Start Date], [Program End Date]))
[Daily $ Spend on Program] = [Total $ Spent on Program]/[Program Duration]
[Q1FY15 $ Spent on Program] = [Daily $ Spend on Program]*(calculate(countrows('Dates'),datesbetween('dates'[DateKey],[ProgramStart],[ProgramEnd]), 'dates'[FiscalYear]=2015), 'dates'[FiscalQuarter]=1)
...and so on for each fiscal quarter/year
In the pivot tables, I have simple measures that sum up each [QxFYyy $ Spend on Program] column to give me the total FY aggregations. [Financial Year] and [Financial Quarter] slicers work fine, and the aggregation measures work fine.
The problem
The above solution works, but I need to plan for the long term. Expecting someone to come behind me a write in 4 new calculated columns every year and then write new measures isn't appealing to me or to my client. I feel like I should be able to write a measure(s) that aggregates the [Daily $ Spent on Program] column in such a way that I can slice the data properly using the [Fiscal Quarter] and [Fiscal Year] columns from my dates table, without needing all those stupid calculated columns. But, all of the measures I've written have the same problem: programs with [Program Start Date] and [Program End Date] that are both within a single quarter work great, but any program that spans a quarter (or even worse, and entire fiscal year) aren't aggregated correctly. Most of the results I've gotten are that programs are always "counted" in the quarter that contains the [Program Start Date] field. Even when I tried breaking the relationship between the 'dates' table and the 'data' table and using a disconnected slicer!
Sample data
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Program Name[/TD]
[TD="align: center"]Program Start Date[/TD]
[TD="align: center"]Program End Date[/TD]
[TD="align: center"]Total $ Spent on Program[/TD]
[/TR]
[TR]
[TD="align: center"]Program 1[/TD]
[TD="align: center"]3/1/2015[/TD]
[TD="align: center"]5/31/15[/TD]
[TD="align: center"]100[/TD]
[/TR]
[TR]
[TD="align: center"]Program 2[/TD]
[TD="align: center"]3/1/2015[/TD]
[TD="align: center"]7/10/15[/TD]
[TD="align: center"]100[/TD]
[/TR]
[TR]
[TD="align: center"]Program 3[/TD]
[TD="align: center"]3/1/2015[/TD]
[TD="align: center"]4/30/16[/TD]
[TD="align: center"]100[/TD]
[/TR]
</tbody>[/TABLE]
Expected Result
[TABLE="class: grid, width: 800"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]2015[/TD]
[TD="align: center"]2015[/TD]
[TD="align: center"]2015[/TD]
[TD="align: center"]2015[/TD]
[TD="align: center"][/TD]
[TD="align: center"]2016[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]Program Name[/TD]
[TD="align: center"]Q1[/TD]
[TD="align: center"]Q2[/TD]
[TD="align: center"]Q3[/TD]
[TD="align: center"]Q4[/TD]
[TD="align: center"]2015 Total[/TD]
[TD="align: center"]Q1[/TD]
[TD="align: center"]2016 Total[/TD]
[/TR]
[TR]
[TD="align: center"]Program 1[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]Program 2[/TD]
[TD="align: center"]50[/TD]
[TD="align: center"]50[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]Program 3[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]80[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]280[/TD]
[TD="align: center"][/TD]
[TD="align: center"]20[/TD]
[/TR]
</tbody>[/TABLE]
If anyone has any ideas or guidance on how this might be accomplished, I'd be eternally grateful! I'm driving myself crazy on this one.
Thanks!
The situation
I'm working on a reporting project that pulls customer data from an external solution I cannot change. I'm crunching the data in Excel/PowerPivot 2013. In my external source, the data is being collected as rows with the following relevant columns:
[Program Name] - [Program Start Date] - [Program End Date] - [Total $ Spent on Program]
My task is to break the [Total $$$ Spend on Program] field into a [Daily $ Spent on Program] number and then roll it up into fiscal quarters and fiscal years.
The somewhat successful solution
- I have a typical 'Dates' table with fiscal quarters and fiscal years and a relationship created between the [Program Start Date] and the [Date Key].
- I've written calculated columns that use my 'Dates' table to count the applicable rows between [Program Start Date] and [Program End Date] and divides the [Total $ Spent on Program] by that calculated number of days to get a [Daily $ Spent on Program] value. Then more calculated columns that multiply the [Daily $ Spend on Program] by a count of days in the program that occur in each fiscal quarter and year.
The calculated columns & formulas look something like this:
[Program Duration] = calculate(countrows('Dates'), datesbetween('dates'[DateKey],[Program Start Date], [Program End Date]))
[Daily $ Spend on Program] = [Total $ Spent on Program]/[Program Duration]
[Q1FY15 $ Spent on Program] = [Daily $ Spend on Program]*(calculate(countrows('Dates'),datesbetween('dates'[DateKey],[ProgramStart],[ProgramEnd]), 'dates'[FiscalYear]=2015), 'dates'[FiscalQuarter]=1)
...and so on for each fiscal quarter/year
In the pivot tables, I have simple measures that sum up each [QxFYyy $ Spend on Program] column to give me the total FY aggregations. [Financial Year] and [Financial Quarter] slicers work fine, and the aggregation measures work fine.
The problem
The above solution works, but I need to plan for the long term. Expecting someone to come behind me a write in 4 new calculated columns every year and then write new measures isn't appealing to me or to my client. I feel like I should be able to write a measure(s) that aggregates the [Daily $ Spent on Program] column in such a way that I can slice the data properly using the [Fiscal Quarter] and [Fiscal Year] columns from my dates table, without needing all those stupid calculated columns. But, all of the measures I've written have the same problem: programs with [Program Start Date] and [Program End Date] that are both within a single quarter work great, but any program that spans a quarter (or even worse, and entire fiscal year) aren't aggregated correctly. Most of the results I've gotten are that programs are always "counted" in the quarter that contains the [Program Start Date] field. Even when I tried breaking the relationship between the 'dates' table and the 'data' table and using a disconnected slicer!
Sample data
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Program Name[/TD]
[TD="align: center"]Program Start Date[/TD]
[TD="align: center"]Program End Date[/TD]
[TD="align: center"]Total $ Spent on Program[/TD]
[/TR]
[TR]
[TD="align: center"]Program 1[/TD]
[TD="align: center"]3/1/2015[/TD]
[TD="align: center"]5/31/15[/TD]
[TD="align: center"]100[/TD]
[/TR]
[TR]
[TD="align: center"]Program 2[/TD]
[TD="align: center"]3/1/2015[/TD]
[TD="align: center"]7/10/15[/TD]
[TD="align: center"]100[/TD]
[/TR]
[TR]
[TD="align: center"]Program 3[/TD]
[TD="align: center"]3/1/2015[/TD]
[TD="align: center"]4/30/16[/TD]
[TD="align: center"]100[/TD]
[/TR]
</tbody>[/TABLE]
Expected Result
[TABLE="class: grid, width: 800"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]2015[/TD]
[TD="align: center"]2015[/TD]
[TD="align: center"]2015[/TD]
[TD="align: center"]2015[/TD]
[TD="align: center"][/TD]
[TD="align: center"]2016[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]Program Name[/TD]
[TD="align: center"]Q1[/TD]
[TD="align: center"]Q2[/TD]
[TD="align: center"]Q3[/TD]
[TD="align: center"]Q4[/TD]
[TD="align: center"]2015 Total[/TD]
[TD="align: center"]Q1[/TD]
[TD="align: center"]2016 Total[/TD]
[/TR]
[TR]
[TD="align: center"]Program 1[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]Program 2[/TD]
[TD="align: center"]50[/TD]
[TD="align: center"]50[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]-[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]Program 3[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]80[/TD]
[TD="align: center"]20[/TD]
[TD="align: center"]20[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]280[/TD]
[TD="align: center"][/TD]
[TD="align: center"]20[/TD]
[/TR]
</tbody>[/TABLE]
If anyone has any ideas or guidance on how this might be accomplished, I'd be eternally grateful! I'm driving myself crazy on this one.
Thanks!