Forum Discussion

manojk_pbi's avatar
manojk_pbi
Helper V
2 years ago
Solved

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

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

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    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

    Best Regards

3 Replies