The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I have added in custom icons by uploading a .json file of icons I found online and wanted to use. Is there any way I can use these icons in DAX?
I currently use a switch statement to switch between icons since I have a matrix.
I tried adding in the description from the .json as the icon name, but it did not work.
If this is not possible, is there any other way to add additional icons and use them in DAX?
Thank you.
Hi @Mary_789
You are expecting the above If am correct. If you want to install custome icons on DAX there is function called UNICHAR.
Here is example DAX
Vs LY Profit =
VAR difference = [Profit] - [Profit LY]
VAR LYchange =
DIVIDE ( difference, [Profit LY], 0 )
RETURN
SWITCH (
TRUE (),
LYchange > 0,
UNICHAR ( 9650 ) & " +"
& FORMAT ( LYchange, "0.0 %" ) & " || " & "+ "
& FORMAT ( difference, "0" ),
UNICHAR ( 9660 ) & FORMAT ( LYchange, "0.0 %" ) & " || "
& FORMAT ( difference, "0" )
)
----------------------------------
If you need mor information about UNICHAR. Pls go through below URLs.
Icons In Power BI | DAX, UNICHAR, UNICODE & Custom Images – Master Data Skills + AI (enterprisedna.c...
How to use custom Icons in DAX expressions (youtube.com)
Hi @Mary_789
Not sure how you are using a JSON file for icons? Or what you want to use these icons for?
But you can use custom icons by loading them to a web accessible location and then pointing to that location/icon file - see the section about Custom Icons in this post I wrote
Conditional Formatting in Power BI Tables and Matrices • My Online Training Hub
Your code could look something like this
Regards
Phil
Proud to be a Super User!
Hello @PhilipTreacy ,
I am using json file method using the following link: https://pbivisuals.com/2021/10/29/how-to-add-custom-icons-in-power-bi-conditional-formatting/
I am able to upload the icons and use it under conditional formatting, but not in DAX.
I am using a MAXX function in DAX and return a switch true with different icons. Below is the DAX,
status =
var stat = MAXX('stat_data', 'stat_data'[Status])
return
Switch(true(),
stat = "1", "CircleHigh",
stat = "2", "CircleMedium1",
stat = "3", "4CircleMedium2"
)
I want to add custom icons to stat.
Hi Mary, I know that this post could be a bit old.
But currently I am facing the same situation and I would like if you solve it and how?
Thank you in advance
User | Count |
---|---|
77 | |
75 | |
36 | |
31 | |
28 |
User | Count |
---|---|
94 | |
80 | |
55 | |
48 | |
48 |