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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Srinivas904
Helper I
Helper I

Need condition color formatting for a particular line in Matrix tables

Hello everyone, I need a urgent help on this I am using 2 measure in a single measure to show with a custom table. I have attched Dax below.

 

Srinivas904_0-1712668479604.png

 

Cumulative Revenue Switch =
SWITCH(
    SELECTEDVALUE(Performance[Revenues]), -- Detect the selected row
    "FC", [Cumulative FCST],
    "Actual Revenue", [Cumulative Revenue],
    BLANK() -- Handle other cases (e.g., when nothing is selected)
)


I need a help based on this measure If [Cumulative Revenue] is less than [Cumulative FCST], show red. If it's greater, show green. However, I need this conditional formatting to apply only to the 'Actual Revenue' line. Currently, I'm using one measure for conditional formatting, but it's being applied to both lines, whereas I only want it for the 'Actual Revenue' line.

below is the measure I am using for conditional formatting
Color Measure =
IF(
    [Cumulative Revenue] < [Cumulative FCST],
    "#EFB5B9",  -- Red color code
    IF(
        [Cumulative Revenue] > [Cumulative FCST],
        "#C8F8CD",  -- Green color code
        BLANK()  -- If [Cumulative Revenue] equals [Cumulative FCST], return BLANK
    )
)

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Srinivas904 ,
Thanks for @Rupak_bi reply. According to your description, you are using meaure to populate the value of the matrix. however, meaure needs to rely on the context in order to be computed, so trying to do conditional formatting is not possible. conditional fromatting can only work on the entire value value.
Of course, you can do this by using a table, but you need to create a calculated column.

Best regards,

Albert He

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @Srinivas904 ,
Thanks for @Rupak_bi reply. According to your description, you are using meaure to populate the value of the matrix. however, meaure needs to rely on the context in order to be computed, so trying to do conditional formatting is not possible. conditional fromatting can only work on the entire value value.
Of course, you can do this by using a table, but you need to create a calculated column.

Best regards,

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Rupak_bi
Impactful Individual
Impactful Individual

Hi,

 

Please share sample data to give you the solution. Mean while try below formula

 

 

Color Measure =
IF(
Performance[Revenues]="Actual Revenue",
IF(
    [Cumulative Revenue] < [Cumulative FCST],
    "#EFB5B9",  -- Red color code
    IF(
        [Cumulative Revenue] > [Cumulative FCST],
        "#C8F8CD",  -- Green color code
        BLANK()  -- If [Cumulative Revenue] equals [Cumulative FCST], return BLANK
    )
)
,
blank()
)



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/
Rupak_bi
Impactful Individual
Impactful Individual

create flag variable insted of colour and use that for conditional formating



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

Hi @Rupak_bi , Thanks for replying any example please ?

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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