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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MintuBaruah
Helper III
Helper III

Conditional Formating

Hello @all

 

I have a table with the following data(Table 1) where I want to apply conditional formatting on the values in header 2 conditions if it is True.

Table 1(Dummy Data):

Header 1

Header 2

A975
A975
A1975
B1000
B756
C250

 

Condition: If A in Header 1 repeats more than 2 times then True()

and if it is true then the background color of the values should change to a different color(eg: #FF0000)

 

Please help in resolving this issue.

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@MintuBaruah , A In the visual not repeat unless you some ungrouped column may be header 2

 

But you can try like 

color measure =

var _1 = calculate(coutrows(Table[header 1]), filter(allselected(Table1), Table1[Header 1] =max( Table1[Header 1]))

return

if(_1>=2, "blue", "green" )

 

You can use this measure in conditional formatting using field value option

 

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

 

View solution in original post

v-eqin-msft
Community Support
Community Support

Hi @MintuBaruah ,

 

According to my understanding, You want to set TRUE() for Header1 with more than 2 lines, otherwise FALSE() . And then set colors for these two flag, right?

 

Please follow these steps:

1. Create a measure for True/False:

True or False = 
var _count= CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Header 1]))
return IF(_count>2,TRUE(),FALSE())

2.Set colors for both:

Color = SWITCH([True or False],TRUE(),"Green", FALSE(),"Red") 

3. Configure Conditional formatting for Header1:

Conditional formatting .jpg

Based on Color measure to set Conditional formatting.PNG

The final output is shown below:

Conditional Formating output.PNG

Best Regards,
Eyelyn Qin
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

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

Hi @MintuBaruah ,

 

According to my understanding, You want to set TRUE() for Header1 with more than 2 lines, otherwise FALSE() . And then set colors for these two flag, right?

 

Please follow these steps:

1. Create a measure for True/False:

True or False = 
var _count= CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Header 1]))
return IF(_count>2,TRUE(),FALSE())

2.Set colors for both:

Color = SWITCH([True or False],TRUE(),"Green", FALSE(),"Red") 

3. Configure Conditional formatting for Header1:

Conditional formatting .jpg

Based on Color measure to set Conditional formatting.PNG

The final output is shown below:

Conditional Formating output.PNG

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

amitchandak
Super User
Super User

@MintuBaruah , A In the visual not repeat unless you some ungrouped column may be header 2

 

But you can try like 

color measure =

var _1 = calculate(coutrows(Table[header 1]), filter(allselected(Table1), Table1[Header 1] =max( Table1[Header 1]))

return

if(_1>=2, "blue", "green" )

 

You can use this measure in conditional formatting using field value option

 

How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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