Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Dear community,
I am trying to play around with dynamic svg visuals and after trying out several tutorials that never worked in my current working file, I tried it in a new powerBI file and this time it worked.
It is though inconvenient, as I don't want to recreate my whole work in a new pbix.
Does anyone know why? Are there any settings that may interfere with the results of a measure? Or could relationships in the data models have an impact?
This is the code I tried in 2 places: (the division in the the 1st VAR is numerical to easily test it)
Gender_M_Icon =
//Define the percentage to be coloured
VAR percentageArea = DIVIDE(70,100)
//Define the colors
VAR fillColor = "#00477A"
VAR backgroundColor = "#cccccc"
var svg = "data:image/svg+xml;utf8,
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'>
<defs>
<clipPath id='maskClip'>
<rect x='0' y='0' width='512' height='"& 512*(1-percentageArea) &"' />
</clipPath>
</defs>
<g style='fill:"&fillColor&";'>
<circle cx='256' cy='51.2' r='51.2'/>
<path d='M341.333,119.467H170.667c-23.564,0-42.667,19.103-42.667,42.667v128c0,14.138,11.461,25.6,25.6,25.6
c14.138,0,25.6-11.461,25.6-25.6V179.2h17.067v307.2c0,14.138,11.462,25.6,25.6,25.6s25.6-11.461,25.6-25.6V315.733h17.067V486.4
c0,14.138,11.462,25.6,25.6,25.6s25.6-11.461,25.6-25.6V179.2H332.8v110.933c0,14.138,11.462,25.6,25.6,25.6
s25.6-11.461,25.6-25.6v-128C384,138.569,364.898,119.467,341.333,119.467z'/>
</g>
<g style='fill:"&backgroundColor&";clip-path:url(#maskClip)'>
<circle cx='256' cy='51.2' r='51.2'/>
<path d='M341.333,119.467H170.667c-23.564,0-42.667,19.103-42.667,42.667v128c0,14.138,11.461,25.6,25.6,25.6
c14.138,0,25.6-11.461,25.6-25.6V179.2h17.067v307.2c0,14.138,11.462,25.6,25.6,25.6s25.6-11.461,25.6-25.6V315.733h17.067V486.4
c0,14.138,11.462,25.6,25.6,25.6s25.6-11.461,25.6-25.6V179.2H332.8v110.933c0,14.138,11.462,25.6,25.6,25.6
s25.6-11.461,25.6-25.6v-128C384,138.569,364.898,119.467,341.333,119.467z'/>
</g>
</svg>
"
return svg
In my current working document, it renders:
In a new one it renders properly the 70%:
Any clue?
HI @Svendu ,
Could you pls share your pbix file ,remember to remove confidential data.
Best Regards
Lucien
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
85 | |
83 | |
66 | |
61 | |
58 |
User | Count |
---|---|
194 | |
111 | |
105 | |
79 | |
71 |