Forum Discussion
Comparing value to previous Column in matrix
- Anonymous2 years ago
Hi VDebande ,
Please try:Diff = IF ( SELECTEDVALUE ( 'Date'[Week] ) = 1, 0, [YourMeasure] - CALCULATE ( [Total Profit], 'Date'[Week] = SELECTEDVALUE ( 'Date'[Week] ) - 1 ) )Diff% = VAR _cur_week = [Total Profit] VAR _pre_week = CALCULATE([YourMeasure],'Date'[Week]=SELECTEDVALUE('Date'[Week])-1) VAR _diff_rate = ABS(IF(SELECTEDVALUE('Date'[Week])=1,0, DIVIDE(_cur_week-_pre_week,_pre_week))) VAR _result = IF(_cur_week>=_pre_week,_diff_rate,-_diff_rate) RETURN _result
Next, you can set the conditional format according to your needs.Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi VDebande ,
Please try:
Diff =
IF (
SELECTEDVALUE ( 'Date'[Week] ) = 1,
0,
[YourMeasure]
- CALCULATE (
[Total Profit],
'Date'[Week]
= SELECTEDVALUE ( 'Date'[Week] ) - 1
)
)
Diff% =
VAR _cur_week = [Total Profit]
VAR _pre_week = CALCULATE([YourMeasure],'Date'[Week]=SELECTEDVALUE('Date'[Week])-1)
VAR _diff_rate = ABS(IF(SELECTEDVALUE('Date'[Week])=1,0, DIVIDE(_cur_week-_pre_week,_pre_week)))
VAR _result = IF(_cur_week>=_pre_week,_diff_rate,-_diff_rate)
RETURN
_result
Next, you can set the conditional format according to your needs.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group