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

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

Reply
Anonymous
Not applicable

Using icons in conditional formatting

Hi, 

I'm trying to get icons displayed for Revision date column and using this measure which works fine:

 

CF1 =
VAR number_of_days =
SELECTEDVALUE ( 'MDR'[Revision date]) - TODAY ()
RETURN
SWITCH (
TRUE (),
number_of_days < 0, "Red",
number_of_days < 180, "Orange",
"Green"
)
 
But that only allows me to apply formatting by Field value which doesn't have the icon feature.
So I found this extra measure based on the previous one:
 
CF2 =
SWITCH(MAX([CF1]),
"Green",2,
"Yellow",1,
"Red",0
)
 
But it turns out CF1 has to be a column not a measure for the whole thing to work.
How do I convert CF1 from being a measure to a column?
Should I try a different approach?!
 
1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @Anonymous ,

 

I guess the revision date in the same table as the calculated column. Then try the following formula:

CF1 =
VAR number_of_days = 'MDR'[Revision date] - TODAY()
RETURN
    SWITCH(
        TRUE(),
        number_of_days < 0, "Red",
        number_of_days < 180, "Orange",
        "Green"
    )

 

Be aware that a calculated column is always static, so the value will be evaluated when the data model is loaded. After that the values stay as they are. They won't change when you change a slicer or something like that.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@Anonymous 

You can do it with one measure, modify your measure as follows:

CF1 = 
VAR number_of_days =
    SELECTEDVALUE ( Table5[Date]) - TODAY ()
RETURN
    SWITCH (
        TRUE (),
        number_of_days < 0, 1,
        number_of_days < 180, 2,
        3
    )


Select the Date and Icon for CF:

Fowmy_0-1622449678127.png

Configure CF as follows:

Fowmy_1-1622449710113.png

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

selimovd
Super User
Super User

Hey @Anonymous ,

 

I guess the revision date in the same table as the calculated column. Then try the following formula:

CF1 =
VAR number_of_days = 'MDR'[Revision date] - TODAY()
RETURN
    SWITCH(
        TRUE(),
        number_of_days < 0, "Red",
        number_of_days < 180, "Orange",
        "Green"
    )

 

Be aware that a calculated column is always static, so the value will be evaluated when the data model is loaded. After that the values stay as they are. They won't change when you change a slicer or something like that.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.