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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
kimchizal
Helper II
Helper II

Creating a measure to conditionally format a matrix

I'm struggling to figure out how to create a measure to conditionally format a matrix. Here's a picture of my matrix:

pbi.PNG

 

 

I"d like to color code all 3 columns under the post group, so that if the value is greater than the corresponding value in the 'Pre' group, then color code green, otherwise color code red

I have my data in a long format rather than wide, so I'm not sure how to go about creating the DAX measure to do this. Here's a sample of it:

1 ACCEPTED SOLUTION

Hi @kimchizal,

 

Please download the demo from the attachment. Please also refer to power-bi/desktop-conditional-table-formatting.

formatMeasure =
VAR postValue =
    CALCULATE (
        [Program(s)],
        FILTER ( ALL ( Sheet3[prepost] ), Sheet3[prepost] = "Post" )
    )
VAR preValue =
    CALCULATE (
        [Program(s)],
        FILTER ( ALL ( Sheet3[prepost] ), Sheet3[prepost] = "Pre" )
    )
RETURN
    IF ( postValue > preValue, 1, 0 )

Creating-a-measure-to-conditionally-format-a-matrix

 

 

BTW, please don't share sensitive data here.

 

Best Regards,

Community Support Team _ Dale
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

3 REPLIES 3
v-jiascu-msft
Employee
Employee

Hi @kimchizal,

 

Could you please mark the proper answers as solutions?

 

 

Best Regards,

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

Here's a link to the data: removed

Hi @kimchizal,

 

Please download the demo from the attachment. Please also refer to power-bi/desktop-conditional-table-formatting.

formatMeasure =
VAR postValue =
    CALCULATE (
        [Program(s)],
        FILTER ( ALL ( Sheet3[prepost] ), Sheet3[prepost] = "Post" )
    )
VAR preValue =
    CALCULATE (
        [Program(s)],
        FILTER ( ALL ( Sheet3[prepost] ), Sheet3[prepost] = "Pre" )
    )
RETURN
    IF ( postValue > preValue, 1, 0 )

Creating-a-measure-to-conditionally-format-a-matrix

 

 

BTW, please don't share sensitive data here.

 

Best Regards,

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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