Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Conditionnal formating per line in a matrice

Hello, 

I need help with conditionnal formating on a matrice. I have a matrice with 4 lines (duration) and 4 columns (years), I need to do a different conditionnal formating for each line of the matrice. For example : for the first line all figures above 3 are red, for the second line all figures above 3 are green ...

Is it possible ? 

Thank you for your help !

 

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

First we create a measure to define the color, then using this measure to formatting condition as field value, you can change the DAX to meet your requirement, the outter SWITCH() control the line condition and the inner control different color format in line.

 

Color = 
SWITCH (
    SELECTEDVALUE ( 'Table'[Duration] ),
    "Autumn", SWITCH (
        TRUE (),
        SUM ( 'Table'[Value] ) >= 3, "#FF0000",
        SUM ( 'Table'[Value] ) < 3, "0000FF"
    ),
    "Spring", SWITCH (
        TRUE (),
        SUM ( 'Table'[Value] ) >= 3, "#00FF00",
        SUM ( 'Table'[Value] ) < 3, "0000FF"
    )
)

Conditionnal-formating-per-line-in-a-matrice-1.pngConditionnal-formating-per-line-in-a-matrice-2.pngConditionnal-formating-per-line-in-a-matrice-3.png

 

BTW, pbix as attached.

 

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

First we create a measure to define the color, then using this measure to formatting condition as field value, you can change the DAX to meet your requirement, the outter SWITCH() control the line condition and the inner control different color format in line.

 

Color = 
SWITCH (
    SELECTEDVALUE ( 'Table'[Duration] ),
    "Autumn", SWITCH (
        TRUE (),
        SUM ( 'Table'[Value] ) >= 3, "#FF0000",
        SUM ( 'Table'[Value] ) < 3, "0000FF"
    ),
    "Spring", SWITCH (
        TRUE (),
        SUM ( 'Table'[Value] ) >= 3, "#00FF00",
        SUM ( 'Table'[Value] ) < 3, "0000FF"
    )
)

Conditionnal-formating-per-line-in-a-matrice-1.pngConditionnal-formating-per-line-in-a-matrice-2.pngConditionnal-formating-per-line-in-a-matrice-3.png

 

BTW, pbix as attached.

 

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.