Forum Discussion

duesouth's avatar
duesouth
Helper I
1 year ago
Solved

Add Arrows to a Matrix

I've got a matrix for % attendance in a school - which is cumulative attendance week-on-week, as below:                                                                                          ...
  • Elena_Kalina's avatar
    1 year ago

    Hi duesouth 

    1. First create a measure to calculate the difference:

    Attendance Change = 
    VAR CurrentWeek = MAX('Date'[Date])
    VAR CurrentAttendance = [Attendance Measure]
    
    VAR PreviousWeek = 
        CALCULATE(
            MAX('Date'[Date]),
            FILTER(
                ALLSELECTED('Date'),
                'Date'[Date] < CurrentWeek
            )
        )
    
    VAR PreviousAttendance = 
        CALCULATE(
            [Attendance Measure],
            FILTER(
                ALLSELECTED('Date'),
                'Date'[Date] = PreviousWeek
            )
        )
    
    RETURN
        IF(
            NOT(ISBLANK(PreviousAttendance)),
            CurrentAttendance - PreviousAttendance,
            BLANK()
        )
    1. Then apply conditional formatting to your attendance values:

      • Select your matrix visual

      • Go to "Conditional formatting" → "Icons"

      • Set up rules like:

        • When value > 0.001 → Green up arrow

        • When value < -0.001 → Red down arrow

      • Base the formatting on the "Attendance Change" measure

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

    Thank you.