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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rsramos78
Regular Visitor

Matrix - Conditional formatting based on the result of a DAX function

Hi, 

I have the below Matrix and want to change the background color of the line "+/- Var" only where the values are negative (<0). (If negative = red, if positive = green)

However the line is a calculation created by the DAX function below:

Values =
VAR result =
CALCULATE (
SUM ( 'BDR Combined'[Value] ),
VALUES ( 'BDR Type'[Type]),
VALUES ( 'BDR Months'[Month] )
)
VAR list =
SUMMARIZE ( ALLSELECTED ( 'BDR Combined'), [Year], [Type], "Result", result )
RETURN
IFERROR (IF(
result <> BLANK (),
result,
VAR Pipe =
CALCULATE ( SUM ( 'BDR Combined'[Value] ), 'BDR Type'[Type] = "Pipeline" )
VAR Tgt =
CALCULATE ( SUM ( 'BDR Combined'[Value] ), 'BDR Type'[Type] = "Target" )
RETURN
SWITCH (
SELECTEDVALUE ( 'BDR Type'[Type] ),
"+/- Var", Pipe - Tgt,
"% Var",( Pipe / Tgt ) * 100,
BLANK ()
)
),bLANK())

rsramos78_0-1639686037773.png

 

How could I achieve it?

Thanks in advance!

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

create a "sister" measure that outputs the desired color names, and then use that as the basis for the conditional formatting of the main measure value in the matrix.

View solution in original post

2 REPLIES 2
rsramos78
Regular Visitor

Hi @lbendlin , I've followed this path and was able to make it to work.

Thanks,

lbendlin
Super User
Super User

create a "sister" measure that outputs the desired color names, and then use that as the basis for the conditional formatting of the main measure value in the matrix.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.