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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Srinivas904
Frequent Visitor

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
v-heq-msft
Community Support
Community Support

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
v-heq-msft
Community Support
Community Support

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
Helper V
Helper V

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()
)

Rupak_bi
Helper V
Helper V

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

Hi @Rupak_bi , Thanks for replying any example please ?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors