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
fbittencourt
Advocate II
Advocate II

Combine conditional formating ( icone + color)

Hi guys !! I need to combine the value color change with the icon besides on a card.
 
 I have tried this, but is not working.
      // ABS(KP) >= 0 && ABS(KP) <= 0.0549, "#24B64A" & "🟢",

       // ABS(KP) >= 0.055 && ABS(KP) <= 0.1049,"#EAC905" & "🟡",

     //   ABS(KP) >= 0.105 && ABS(KP) <= 1, "#E33010" &"🔴",
 
 
 
 This code below works well.( add the colors values)
 
PCTKPI Icon + Value =

VAR KP = [PctKPI 2]

VAR Icon =

    SWITCH(

        TRUE(),

        ABS(KP) >= 0 && ABS(KP) <= 0.0549, "🟢",

        ABS(KP) >= 0.055 && ABS(KP) <= 0.1049, "🟡",

        ABS(KP) >= 0.105 && ABS(KP) <= 1, "🔴" ,

        ""

    )

RETURN

Icon & " " & FORMAT(KP, "0.00%")
 
Tks all!!
1 ACCEPTED SOLUTION
v-ssriganesh
Community Support
Community Support

Hi @fbittencourt,
Thank you for reaching out to the Microsoft Fabric Forum Community.

I’ve reproduced your scenario in Power BI Desktop using your icon + color formatting logic, and I was able to achieve the expected output combining both the KPI value and the icon with conditional color formatting in a single card.

For your reference:

  • I used the new card visual.
  • The KPI icon and value were combined using a DAX measure.
  • Conditional formatting was applied using a separate measure through the fx (Field value) option in the visual's Color formatting pane.

I’ve attached a .pbix file to help you review.

If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

View solution in original post

2 REPLIES 2
v-ssriganesh
Community Support
Community Support

Hi @fbittencourt,
Thank you for reaching out to the Microsoft Fabric Forum Community.

I’ve reproduced your scenario in Power BI Desktop using your icon + color formatting logic, and I was able to achieve the expected output combining both the KPI value and the icon with conditional color formatting in a single card.

For your reference:

  • I used the new card visual.
  • The KPI icon and value were combined using a DAX measure.
  • Conditional formatting was applied using a separate measure through the fx (Field value) option in the visual's Color formatting pane.

I’ve attached a .pbix file to help you review.

If this information is helpful, please “Accept it as a solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.

bhanu_gautam
Super User
Super User

@fbittencourt 

Create a measure for the icon:

DAX
PCTKPI Icon =
VAR KP = [PctKPI 2]
VAR Icon =
SWITCH(
TRUE(),
ABS(KP) >= 0 && ABS(KP) <= 0.0549, "🟢",
ABS(KP) >= 0.055 && ABS(KP) <= 0.1049, "🟡",
ABS(KP) >= 0.105 && ABS(KP) <= 1, "🔴",
""
)
RETURN
Icon

 

Create a measure for the value:

DAX
PCTKPI Value =
VAR KP = [PctKPI 2]
RETURN
FORMAT(KP, "0.00%")

 

Combine the icon and value in a new measure:

DAX
PCTKPI Icon + Value =
[PCTKPI Icon] & " " & [PCTKPI Value]

 

Go to the card visual where you want to display the combined measure.
Select the measure PCTKPI Icon + Value.
In the visualizations pane, go to the "Format" section.
Find the "Data label" or "Values" section (depending on the visual type).
Click on "Conditional formatting" and choose "Font color".
Set up rules based on the value of [PctKPI 2] to apply the desired colors.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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