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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
MichaelO
Regular Visitor

Conditional Formatting on Field Value Switch not working

Hi,

 

I am trying to use a measure to change the font colour and title of a visual card.

 

The switch function has been set up to determin colour based on 2 meassure.

I want the colour to be green if current week is larger than previous week.

I want the colour to be red if current week is smaller than previous week.

Font Colour = SWITCH(
    TRUE(),
        [Current Week] > [Previous Week], "green",
        [Current Week] < [Previous Week], "red", "black" )

This meassure works correctly as a card shows the return is red. However, for some reason the conditional formatting is using the green format.
The card title confirms this as the title conditional formatting says green. Even though the field is using thE same meassure - "Font Colour."
 
MichaelO_0-1665489863367.png

 

I have tried rearranging the order of my formula to show red first and this hasnt made a difference.

I have used if statements as well and no difference. The font colour result shows red in the 3rd card, however the conditional format says green.

 

Any help on why the conditional formatting is not recognising the correct value will be greatly appreciated.


Best,

Michael

2 REPLIES 2
MichaelO
Regular Visitor

Thank you for your reply, v-zhangt. I appreciate it!

 

That is so strange. But I believed it would be the case. I do not understand why it goes wrong when I place the measure in that specific visual card.

 

Please find the measures for Current week and Previous week:

 

MichaelO_0-1665568779624.png

MichaelO_1-1665568933553.png

 

I shall keep trying and see what happens when I use other measures to try and narrow the problem down.

 

Best,

Michael

 

v-zhangti
Community Support
Community Support

Hi, @MichaelO 

 

I tried to reproduce your problem, but unsuccessfully. You can refer to my measure calculation.

Sample data:

vzhangti_2-1665539392511.png

Current Week = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Week]=WEEKNUM(TODAY(),2)))
Previous Week = CALCULATE(SUM('Table'[Value]),FILTER(ALL('Table'),[Week]=WEEKNUM(TODAY(),2)-1))

vzhangti_1-1665539073875.png

You can expand the value of [Current Week] in the table to see if there is a problem with the calculation.

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors