Forum Discussion

uayan's avatar
uayan
Frequent Visitor
3 years ago

Conditional formatting based on the column it comes from

I have 2 date column in the same table. 

Date 1Date 2 
01.02.2022     05.02.2022
 07.02.2022
03.07.2022     09.02.2022


I brought together these 2 column into single column in this condition. --> IF(Date 1=BLANK(), Date 2, Date 1)

 
And I want to add color based on the column it comes from. (such as date 1 = green, date 2= red)
 
Is that possible?
 
 

1 Reply

  • Hi uayan ,
    Add another measure IF(Date 1=BLANK(), 2, 1)

    Now go to Format for the visual >Visual >Cell Element > Select Date Column> Background Color (on)

    Select Rules in the Format by field of the Background color or Font color dialogue box to format cell background or font color according to rules. Select the new measure field on which the formatting is based, and Summarization displays the field’s aggregate type.

    Enter one or more value ranges and colors for each under Rules. There is an “If” value condition, a value condition, and a color for each value range. Each value range’s cell backgrounds or fonts are colored with the specified color.

    You can also refer to this link to refer to steps for different types of conditional formatting :-
    https://hevodata.com/learn/power-bi-conditional-formatting/#:~:text=To%20apply%20Power%20BI%20Conditional%20Formatting%20in%20Power%20BI%20Desktop,type%20of%20formatting%20you%20want.

     

    Thanks ,
    Pratyasha Samal
    Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
    If you found this post helpful, please give Kudos C