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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Mark_Holland_GD
Helper II
Helper II

Icons & Colours - Combine Metrics for New Card Visual

Hi,

 

I'm using the New Card visual to highlight some key metrics in my report. I'm using the Image and Divider dynamically to highlight changes in the results, as below:

 

Screenshot 2025-02-27 104208.png

 

To do this, I've had to create 2 separate measures - one fo the Icon/Image:

Dynamic Icon = 
VAR Green = [Icons - Tick, Green]
VAR Yellow = [Icons - Circle, Yellow]
VAR Amber = [Icons - Circle, Amber]
VAR Red = [Icons - Exclamation, Red]
RETURN
IF([GDC - Guide Dog Waitlist Average Wait in Weeks] >= 30, Red,
IF([GDC - Guide Dog Waitlist Average Wait in Weeks] >= 25, Amber, 
IF([GDC - Guide Dog Waitlist Average Wait in Weeks] >= 21, Yellow,
Green)))

 

And one for the Colour:

Dynamic Colours = 
VAR Green = [Colour - Green]
VAR Yellow = [Colour - Yellow]
VAR Amber = [Colour - Amber]
VAR Red = [Colour - Red]
RETURN
IF([GDC - Guide Dog Waitlist Average Wait in Weeks] >= 30, Red,
IF([GDC - Guide Dog Waitlist Average Wait in Weeks] >= 25, Amber, 
IF([GDC - Guide Dog Waitlist Average Wait in Weeks] >= 21, Yellow,
Green)))

 

To get the colours and icons I want, I've created separate measures to hold these, that I can use across all of my icon and colour measures.

 

I have a lot of these. There's a chance that if something needs to be changed in one metric, that it won't be carried onto the other. I want to know if there's a way to combine these 2 measures into one so it can be used for the Image and Divider Colour?

 

Any thoughts on how I could do this, if it's possible?

 

Ta,

Mark

3 REPLIES 3
rajendraongole1
Super User
Super User

Hi @Mark_Holland_GD  - Yes! You can combine both the Dynamic Icon and Dynamic Colours measures into a single measure that returns a table with both values. This way, you only need to maintain one measure and reference it wherever needed.

 

Dynamic Icon & Colour =
VAR GreenIcon = [Icons - Tick, Green]
VAR YellowIcon = [Icons - Circle, Yellow]
VAR AmberIcon = [Icons - Circle, Amber]
VAR RedIcon = [Icons - Exclamation, Red]

VAR GreenColour = [Colour - Green]
VAR YellowColour = [Colour - Yellow]
VAR AmberColour = [Colour - Amber]
VAR RedColour = [Colour - Red]

VAR WaitWeeks = [GDC - Guide Dog Waitlist Average Wait in Weeks]

RETURN
SWITCH(
TRUE(),
WaitWeeks >= 30, UNICHAR(128165) & "|" & RedColour, -- Red Exclamation
WaitWeeks >= 25, UNICHAR(128993) & "|" & AmberColour, -- Amber Circle
WaitWeeks >= 21, UNICHAR(128993) & "|" & YellowColour, -- Yellow Circle
UNICHAR(9989) & "|" & GreenColour -- Green Tick
)

 

check the above logic andlet know.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1 ,

 

I've created the following measure, replacing UNICHAR with the Icon URL variables:

 

Total Active Clients Vs Target - Icon/Colour = 
//Icons
VAR GreenIcon = [Icons - Tick, Green]
VAR YellowIcon = [Icons - Circle, Yellow]
VAR AmberIcon = [Icons - Circle, Amber]
VAR RedIcon = [Icons - Exclamation, Red]
//Colours
VAR GreenHex = [Colour - Green]
VAR YellowHex = [Colour - Yellow]
VAR AmberHex = [Colour - Amber]
VAR RedHex = [Colour - Red]
//Metric
VAR Metric = [Total Active Clients]
RETURN
SWITCH(
    TRUE(),
Metric >= 1500, GreenHex & "|" & GreenIcon,
Metric >= 1450, YellowHex & "|" & YellowIcon, 
Metric >= 1400, AmberHex & "|" & AmberIcon, 
RedHex & "|" & RedIcon)

 

It's working for the divider but for the Image URL field on the New Card Visual. Any idea what I should change so the Image URL appears too?

@rajendraongole1  it seems as if it's only recognising the variable before "|". When I swap these around to have the Image variables first, I can see the image but the divider isn't showing any colour.

 

How can we get both to show?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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