Forum Discussion
daniel_kusmider
4 years agoNew Member
Calculating difference to previous row
Hi, I'm trying to duplicate in Power BI calculation that's easly done in Excel in a Pivot Table - % diff to previous visible row. In a Pivot Table you can just choose Show Values as % Difference...
- 4 years ago
Hi, daniel_kusmider
Try to create measures like below:SUM = SUM('Table'[Leads])ThisWeek = CALCULATE( [SUM], FILTER( ALLSELECTED('Table'), 'Table'[End of Week]=MAX('Table'[End of Week]) ) )LastWeek = CALCULATE( [SUM], FILTER( ALLSELECTED('Table'), 'Table'[End of Week]=MAX('Table'[End of Week])-7 ) )LeadDiff% = DIVIDE( [ThisWeek]-[LastWeek], [LastWeek] )Result:
Please refer to the attachment below for details. Hope this helps.
Best Regards,
Community Support Team _ Zeon ZhengIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly
v-angzheng-msft
4 years agoCommunity Support
Hi, daniel_kusmider
Try to create measures like below:
SUM = SUM('Table'[Leads])ThisWeek =
CALCULATE(
[SUM],
FILTER(
ALLSELECTED('Table'),
'Table'[End of Week]=MAX('Table'[End of Week])
)
)LastWeek =
CALCULATE(
[SUM],
FILTER(
ALLSELECTED('Table'),
'Table'[End of Week]=MAX('Table'[End of Week])-7
)
)LeadDiff% =
DIVIDE(
[ThisWeek]-[LastWeek],
[LastWeek]
)
Result:
Please refer to the attachment below for details. Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- daniel_kusmider4 years agoNew Member
Thanks v-angzheng-msft,
That's exactly what I needed.
I actualy found a solution on my own on Power Query level but this is way better.