Power BI Dynamic Icon Image based on condition (New Card Visual)
Syed Ahmed Ali ???? ????
Data Analyst @ Majid Al Futtaim | Data Analyst, BI Developer | Power BI, SQL, Python
Did you know you can dynamically show images based on the numerical values with the new card visual.
Created this whole KPI bar above using only two card visuals. One for the top KPIs, and the second for YoY with arrow icon and PY.
It is a basic chart, but to get dynamic Icon Images this is what I did.
Went to iconscout.com,
1. select the icon
2. modify it according to need
3. download it and save it in google drive.
4. copy the link and make sure sharing is allowed to anyone with the link.
Icon link would be something like this: "https://drive.google.com/file/d/1urxMtx5fWw1pnUBNYdfytLSVymwTd9v3/view?usp=drive_link"
But to be able to call this icon in power bi, we need to modify it.
"https://drive.google.com/thumbnail?id="
After "https://drive.google.com/thumbnail?id=", add the bold part of the icon link and it then can be utilized as an image url as shown below:
"https://drive.google.com/thumbnail?id=1urxMtx5fWw1pnUBNYdfytLSVymwTd9v3"
"https://drive.google.com/uc?id=" & "19NwqV6qGI--6wlD8kaTtzpcU_tCLI85H"
Claims YoY Symb =
VAR OrangeUP = "19NwqV6qGI--6wlD8kaTtzpcU_tCLI85H"
VAR BlueDown = "1oK3hJz0dsoyf15qoUB_DrkO5q9SjvqC_"
VAR Result =
? ? if(
? ? ? ? Pct>=0,
? ? ? ? "https://drive.google.com/thumbnail?id=" & OrangeUP,
? ? ? ? "https://drive.google.com/thumbnail?id=" & BlueDown
? ? )
RETURN
? ? Result"
Make sure to mark the measure as an image url
Select the required series for which you want to apply this image for, go to image section and select this measure for Symb inside of image url field.
Similarly, conditional formatting on the accent bars can be applied as well and it will help creating a KPI indictor without having to use any other measures or external links.
Hope it helps and opens up new possibilities for your scenarios.
Power BI Developer | Trainer | Senior Data Analyst | Microsoft Data & AI Professional | Proces Optimization | Data Visualization
1 年This type of KPI card is what im looking for, so thanks for your tutorial. I have an additional question, there is 3 numbers per tile. In your article you say that you used 2 card visuals. One for the main numbers at the top and one for the YoY and arrow. How did you do the absolute values (the ones with PY) in the bottom row?
Programmer Analyst-ProcDNA | IIMB | Ex-Data Analyst-Turacoz | MSc-Data Science-Symbiosis | Power Bi Certified | DP-600 Fabric & DP-203 Azure Certified | Tableau Certified
1 年You can do this with unichar code also.