Forum Discussion

lkshck's avatar
lkshck
Icon for Helper III rankHelper III
4 years ago
Solved

Average Cost per Day with conditional formatting

Hey, I created an measure for average cost per day, which is shown in a monthly table. In this table I want to use conditional formatting to mark if the previous month is higher, lower or the same. ...
  • lkshck's avatar
    4 years ago

    Got it working with the following Measure:

    IconAzAvg = 
    VAR _val =
     CALCULATE ( AVERAGEX(VALUES('DateDimension'[Date]), [Sum_Cost])  )
    -
     CALCULATE ( AVERAGEX(VALUES('DateDimension'[Date]), [Sum_Cost]),
            PREVIOUSMONTH ( 'DateDimension'[Date] )    )
            
    RETURN
        SWITCH ( TRUE (),
       _val < 0, -1, 
       _val = 0, 0,
       _val > 0, 1 )