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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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 Sage
Solution Sage

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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