cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
asepyudistira
Regular Visitor

My Conditional Formatting in Card wouldn't apply to the filters. Am I doing something wrong?

asepyudistira_3-1656382752204.png

 

As you can see here, in the multi-row card visual, I already implemented the filter successfully. Only the corrosion rate (mm/y) and retirement year (2037) of the Equipment ID that I filtered on the right.

 

I want to conditionally format the background matching the retirement year. If it is below 2025, the background color will be red. However, when I try to conditionally format the background, as you can see below, I don't know what to choose since if I choose Sum, the conditional formatting value will only work on the TOTAL sum of all the retirement years instead of ONLY the filtered value (2037). Can you guys help me on this? I'm quite new on Power-BI. Thank you so much.

asepyudistira_2-1656382661361.png

 

 

 

2 REPLIES 2
johncolley
Solution Specialist
Solution Specialist

Hi @asepyudistira ,

 

Rather than formatting by a rule, it is better to format by a measure in the field value option. You can change it by changing the first dropdown menu 'Format By'.

 

A measure similar to the below would do the trick: 

Background Colour = 
var year = SELECTEDVALUE(Corrosion[Year])
var colouring = SWITCH(
TRUE(),
year < 2025, "Red",
year >= 2025, "Green")
return
colouring
Please note that the conditional formatting on multi-row cards doesn't work as well as you would expect. 
 
 
If you are trying to show multiple years at the same time with conditional formatting a table would be a better approach. Below is an example: 
 
johncolley_0-1656388812808.png

Thank you so much, it's a great suggestion.

 

I tried it, however, it didn't work as I expected.

As you can see below, I already copied your formula:

asepyudistira_0-1656492395580.png

 

The result for this specific visual should be green since the returned value for the year is 2037. Instead, the background colour changes to red:

 

asepyudistira_1-1656492480278.png

 

I guess the returned colour will always be red, somehow. In the below picture I tried to filter only equipment with retirement year 2021, and it's red, not green. (If the formula above is the reverse then the colour should be green)

 

asepyudistira_0-1656494507946.png

 

 

Can you help me with this? Am I being stupid? 

 

Thank you so much.

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors