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:

 

                                                                                      Week Ending
Name23/05/202530/05/202506/06/202513/06/2025
Pupil 195.5%95.5%95.8%95.9%
Pupil 298.1%97.5%97.6%97.6%

 

I'd like Power BI to compare a week to the previous week and add up/down/same arrows to make it easy to see (so for pupil 1, comparing 13 June to 6 June attendance is up, so I'd like an up arrow to be displayed next to the 13/06/2025 column).

 

Is this possible?  As always, any and all help greatly appreciated.

  • 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.

     

4 Replies

  • 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.

     

    • Elena_Kalina's avatar
      Elena_Kalina
      Solution Sage

      If the default arrow icons don't meet your needs, there are several alternative ways to implement custom trend indicators in Power BI:

      1. DAX Character Arrows
        You can directly include arrow symbols (▲▼↗↘→) in your DAX measures by concatenating them with your values. This approach uses Unicode characters and works across all Power BI visuals.

      2. JSON Formatting
        Power BI allows custom icon sets through JSON formatting rules. You can:

        • Create a JSON file defining your preferred icons

        • Specify exact colors and positioning

        • Apply different icon styles for various value ranges
          This method provides consistent styling across your report.

      3. SVG Icons
        For complete design control:

        • Embed SVG code directly in your measures

        • Customize every aspect (shape, color, size)

        • Use any vector graphic as an indicator
          Note: SVG rendering only works in web browsers, not the desktop app.

       

      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.

  • Hi duesouth 

    Try this ...

     

    Create data

     

     

    Create measure

     

    Arrow = 
    VAR thisweek = SELECTEDVALUE('Table'[Week])
    VAR thisattendance = SUM('Table'[Attendance%])
    VAR previousattendance =
    CALCULATE(
        SUM('Table'[Attendance%]),
        ALL('Table'[Week]),
        'Table'[Week] = thisweek - 7
        )
     RETURN
    SWITCH(TRUE(),
    ISBLANK(previousattendance),FORMAT(thisattendance,"Percent"),
    thisattendance =  previousattendance,FORMAT(thisattendance,"Percent"),
    thisattendance >  previousattendance, CONCATENATE(FORMAT(thisattendance,"Percent"), "▲"),
    CONCATENATE(FORMAT(thisattendance,"Percent"), "▼")
     )

     

    Draw matrix

     

     

     

    Please click thumbs up and accept solution