Forum Discussion
Conditional Formatting basede on previous values the Matrix columns
- 7 years ago
You can create this measure:
Icon =
VAR _val =
CALCULATE ( SUM ( Sales[Sales] ) )
-
CALCULATE ( SUM ( Sales[Sales] ),
PREVIOUSMONTH ( 'DateTime'[Date] ) )
RETURN
SWITCH ( TRUE (),
_val < 0, -1,
_val = 0, 0,
_val > 0, 1 )Change the RED to match your columns!
Then, on your matrix, go to the format properties.
Under conditional formatting, select the column and turn on icons, then click advanced editor:In advanced controls, select the following options:
Want even more help with icons?! Check this awesome blog!
https://powerbi.tips/2019/07/icons-upon-icons/
Happy icon-ing :catlol: :womantongue: :robotlol:
How does this work for colums with weeknumbers? There is no "previousweek" formula in PBI 😞
I use this formula:
See screenshot
Use a date table with an index (Example here)
The week index is rolling, with current week being 0, last week -1 and so on. So whatever week you need, you can get the week index and subtract 1 to always get the previous. This way, it doesn't matter if you week falls in a different year.
You need to assign this to a variable and filter the dates table on it:
Icon =
VAR _lastweek = SELECTEDVALUE('Dates'[week index]) - 1
VAR _val =
CALCULATE ( SUM ( Datagrunnlag[Antall solgt]) )
-
CALCULATE ( SUM ( Datagrunnlag[Antall solgt] ),
Dates[week index] = _lastweek )
RETURN
SWITCH ( TRUE (),
_val < 0, -1,
_val = 0, 0,
_val > 0, 1 )