Forum Discussion
'Reversing' Total Calculation in Measure
- 5 years ago
See if this works for you. First the model:
1) measure for sum of values
Sum Values = SUM(FactTable[Values])2) Measure for the ratios (applied to each year)
Avg Ratio = CALCULATE(AVERAGE(Ratio[Ratio]), ALLEXCEPT('Date Table','Date Table'[Year]))3) The result when multiplying by the ratio:
Result = SUMX('Date Table', [Sum Values]*[Avg Ratio])4) The resulting ratio (correct total)
Resulting Ratio = DIVIDE([Result], [Sum Values])5) Running total for values
Running total values = CALCULATE([Sum Values], FILTER(ALL('Date Table'), 'Date Table'[Date] <= MAX('Date Table'[Date])))'8) Running total of results
Running total result = CALCULATE([Result], FILTER(ALL('Date Table'[Date]), 'Date Table'[Date] <= MAX('Date Table'[Date])))9) Finally, the ratio resulting from the running totals
Running total ratio = DIVIDE([Running total result], [Running total values])which gets you this:
Attached is the sample PBIX file
See if this works for you. First the model:
1) measure for sum of values
Sum Values = SUM(FactTable[Values])
2) Measure for the ratios (applied to each year)
Avg Ratio = CALCULATE(AVERAGE(Ratio[Ratio]), ALLEXCEPT('Date Table','Date Table'[Year]))
3) The result when multiplying by the ratio:
Result = SUMX('Date Table', [Sum Values]*[Avg Ratio])
4) The resulting ratio (correct total)
Resulting Ratio = DIVIDE([Result], [Sum Values])
5) Running total for values
Running total values = CALCULATE([Sum Values],
FILTER(ALL('Date Table'),
'Date Table'[Date] <= MAX('Date Table'[Date])))
'8) Running total of results
Running total result = CALCULATE([Result],
FILTER(ALL('Date Table'[Date]),
'Date Table'[Date] <= MAX('Date Table'[Date])))
9) Finally, the ratio resulting from the running totals
Running total ratio = DIVIDE([Running total result], [Running total values])
which gets you this:
Attached is the sample PBIX file
Thank you very much,
PaulDBrown !!! This works!
I appreciate all your help and the effort you put into solving my problem!