DAX/Power Pivot: Calculate 75% Expended Date from Cumulative Total

廉价感情. 提交于 2019-12-11 08:29:28

问题


I have three tables that contain cost: Forecasted Cost, Actual Costs, Invoiced Costs. Each has an "EAC Filter" column for a Y/N of whether to include the cost in an Estimate at Completion, which automatically changes over time and/or as data is added. Here are examples:

EAC from the three tables can be calculated as follows:

Total Cost = Sum(Forecast[Cost])+Sum(Actual[Cost])+Sum(Invoice[Cost])
EAC = Calculate([Total Cost],EAC_Filter[EAC Filter]="Y")

I have a budget at the "Account" level, which could also be rolled up to a "Dept" level budget.

I need a measure for my Power Pivot table which will display the week at which costs have exceeded, or are forecasted to exceed 75% of the budget, using some sort of a cumulative cost, combined with the max week where cumulative cost >= .75 * Budget.

The weeks are numbered through the year as follows:

Thanks for your help!


回答1:


Given an EAC measure which sums the cost per week,

EAC = CALCULATE(SUM(Forcast[Cost]) + SUM(Acutal[Cost]) + SUM(Invoice[Cost]),
                EAC_Filter[EAC Filter] = "Y")

You can create a Cumulative Cost measure as follows:

Cumulative Cost = CALCULATE([EAC],
                      FILTER(ALL('Calendar'), 'Calendar'[Week] <= MAX('Calendar'[Week])))

Using this, we can create a measure that predicts the week the cost exceeds 75% of the budget:

75% Week = MINX(FILTER(ALL('Calendar'), [Cumulative Cost] > 0.75 * SUM(Budget[Budget])),
               'Calendar'[Week])

Here's what the relationships structure looks like:



来源:https://stackoverflow.com/questions/49372758/dax-power-pivot-calculate-75-expended-date-from-cumulative-total

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!