Forum Discussion
Compounding values in a power BI measure
- 6 years ago
hi Anonymous
For your case, you could try this way as below:
Step1:
Add an index column by yearweek column ([Year]*100+[WeekNum]) in date table.
Index = RANKX('Date',('Date'[Year]*100+'Date'[Weeknum]),,ASC,Dense)Step2:
Use this logic to get your requirement:
Result = ( CALCULATE ( [Your percentage measure], FILTER ( ALL ( 'Date' ), 'Date'[Index] = MAX ( 'Date'[Index] ) - 1 ) ) + [Your percentage measure] ) / 2By the way, the result should be 29: (-73.37) + (-72.26))/2= -73.315 Week 30: -40.81 and so on
If not your case, please share your sample pbix file and expected output.
Regards,
Lin
hi Anonymous
For your case, you could try this way as below:
Step1:
Add an index column by yearweek column ([Year]*100+[WeekNum]) in date table.
Index = RANKX('Date',('Date'[Year]*100+'Date'[Weeknum]),,ASC,Dense)
Step2:
Use this logic to get your requirement:
Result =
(
CALCULATE (
[Your percentage measure],
FILTER ( ALL ( 'Date' ), 'Date'[Index] = MAX ( 'Date'[Index] ) - 1 )
) + [Your percentage measure]
) / 2
By the way, the result should be 29: (-73.37) + (-72.26))/2= -73.315 Week 30: -40.81 and so on
If not your case, please share your sample pbix file and expected output.
Regards,
Lin
After many Trials and erros, I finally got the result I want. This post gave me the basis for my sollution.
Thanks a LOT for your help!