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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
manojk_pbi
Helper V
Helper V

Conditional background color

Hi ,

 

I have a table with few columns out it couple of columns need to have background color based on condition. Sample data in the table is as below. Pls guide me how can we add multiple conditions 

 

Color coding

manojk_pbi_0-1720284248701.png

Expected result - color coding will be based on the status color defined above and background color should be added where a text is found in Remarks column & rest will be no-color

manojk_pbi_1-1720284276422.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @manojk_pbi ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a measure as below

 

Conditional formatting = 
VAR _remark =
    SELECTEDVALUE ( 'Table'[Remarks] )
VAR _status =
    SELECTEDVALUE ( 'Table'[Status] )
RETURN
    SWITCH (
        TRUE (),
        _remark <> BLANK ()
            && _status = "In-Progress", "Yellow",
        _remark <> BLANK ()
            && _status = "Active", "Blue",
        _remark <> BLANK ()
            && _status = "Resolved", "#89D26B",
        _remark <> BLANK ()
            && _status = "New", "Grey",
        _remark <> BLANK ()
            && _status = "Closed", "Green"
    )

 

2. Apply conditional formatting

Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

vyiruanmsft_0-1720518793553.png

Best Regards

View solution in original post

3 REPLIES 3
foodd
Community Champion
Community Champion

Hello @manojk_pbi , remember to adhere to the decorum of the Community Forum when asking a question.

Please provide your work-in-progress Power BI Desktop file (with sensitive information removed) that covers your issue or question completely in a usable format (not as a screenshot).

https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

Attached the sample data. The required out is to just fill the background for Remarks column based on 2 conditions. First condition is Remarks should not be blank or empty and then apply color code based on the status.

TaskStatusRemarksTrendDate
T1In-ProgresswaitingIncreasing24-Jan
T2Active Increasing24-Jan
T3Resolvedin Tetsingdecreasing24-Jan
T4New decreasing24-Jan
T5Closedissue fixeddecreasing24-Jan
Anonymous
Not applicable

Hi @manojk_pbi ,

I created a sample pbix file(see the attachment), please check if that is what you want.

1. Create a measure as below

 

Conditional formatting = 
VAR _remark =
    SELECTEDVALUE ( 'Table'[Remarks] )
VAR _status =
    SELECTEDVALUE ( 'Table'[Status] )
RETURN
    SWITCH (
        TRUE (),
        _remark <> BLANK ()
            && _status = "In-Progress", "Yellow",
        _remark <> BLANK ()
            && _status = "Active", "Blue",
        _remark <> BLANK ()
            && _status = "Resolved", "#89D26B",
        _remark <> BLANK ()
            && _status = "New", "Grey",
        _remark <> BLANK ()
            && _status = "Closed", "Green"
    )

 

2. Apply conditional formatting

Apply conditional table formatting in Power BI - Power BI | Microsoft Learn

vyiruanmsft_0-1720518793553.png

Best Regards

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.