<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SVG HTML Charts UDFs in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SVG-HTML-Charts-UDFs/m-p/4867839#M185600</link>
    <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Shape =&lt;BR /&gt;(IconIndex:numeric,Color:string)=&amp;gt;&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='48' height='48'&amp;gt;" &amp;amp;&lt;BR /&gt;SWITCH(IconIndex,&lt;BR /&gt;1,"&amp;lt;rect rx='24' x='0' y='0' width='48' height='48' fill='" &amp;amp; Color &amp;amp; "'/&amp;gt;",&lt;BR /&gt;2,"&amp;lt;rect rx='5' x='0' y='0' width='48' height='48' fill='" &amp;amp; Color &amp;amp; "'/&amp;gt;",&lt;BR /&gt;3,"&amp;lt;path d='M5.41421 22.5858L22.5858 5.41421C23.3668 4.63317 24.6332 4.63316 25.4142 5.41421L42.5858 22.5858C43.3668 23.3668 43.3668 24.6332 42.5858 25.4142L25.4142 42.5858C24.6332 43.3668 23.3668 43.3668 22.5858 42.5858L5.41421 25.4142C4.63317 24.6332 4.63316 23.3668 5.41421 22.5858Z' fill='" &amp;amp; Color &amp;amp; "'/&amp;gt;",&lt;BR /&gt;4,"&amp;lt;circle cx='24' cy='24' r='20' stroke='" &amp;amp; Color &amp;amp; "' fill='none' stroke-width='2'/&amp;gt;") &amp;amp; "&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= SVG_Shape(3,if([M.KPI]&amp;gt;=0.5,"green","rgb(255,0,0)"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Text_Icon =&lt;BR /&gt;(TextIcon:string,BackgroundColor:string,FontColor:string)=&amp;gt;&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='96' height='96'&amp;gt;&lt;BR /&gt;&amp;lt;rect rx='5' x='0' y='0' width='96' height='96' fill='" &amp;amp; BackgroundColor &amp;amp; "'/&amp;gt;&lt;BR /&gt;&amp;lt;text x='48' y='48' text-anchor='middle' dominant-baseline='central' font-size='60' fill='" &amp;amp; FontColor &amp;amp; "'&amp;gt;" &amp;amp;&lt;BR /&gt;TextIcon &amp;amp; "&amp;lt;/text1&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;Measure = SVG_Text_Icon(IF([M.KPI]&amp;gt;=1,"A","B"), IF([M.KPI]&amp;gt;=1,"green","red") ,"snow")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Rank =&lt;BR /&gt;(ColumnRank:anyref,MeasureRank:numeric expr,BackgroundColor:string)=&amp;gt;&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='96' height='96'&amp;gt;&lt;BR /&gt;&amp;lt;rect rx='48' x='0' y='0' width='96' height='96' fill='" &amp;amp; BackgroundColor &amp;amp; "'/&amp;gt;&lt;BR /&gt;&amp;lt;text x='48' y='48' text-anchor='middle' dominant-baseline='central' font-size='60' fill='snow'&amp;gt;" &amp;amp;&lt;BR /&gt;RANKX(ALLSELECTED(ColumnRank),MeasureRank) &amp;amp; "&amp;lt;/text&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;&amp;nbsp;Measure = SVG_Rank('store'[storeID],[M.sales],"brown")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Bar =&lt;BR /&gt;(ColumnForBar:anyref,MeasureForBar:numeric expr,Color:string)=&amp;gt;&lt;BR /&gt;VAR MaxValue = MAXX(ALLSELECTED(ColumnForBar), MeasureForBar)&lt;BR /&gt;VAR Width = 280 * MeasureForBar / MaxValue&lt;BR /&gt;RETURN&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='300' height='36' &amp;gt;&lt;BR /&gt;&amp;lt;rect rx='2' x='10' y='16' width='280' height='4' fill='#f0f0f0'/&amp;gt;&lt;BR /&gt;&amp;lt;rect rx='2' x='"&amp;amp; (300-Width)/2 &amp;amp; "' y='12' width='" &amp;amp; Width &amp;amp; "' height='12'&lt;BR /&gt;fill='" &amp;amp; Color &amp;amp; "' stroke='none'/&amp;gt;&lt;BR /&gt;&amp;lt;text x='150' y='8' text-anchor='middle' font-size='11' fill='#333333'&amp;gt;&lt;BR /&gt;" &amp;amp; FORMAT(MeasureForBar,"#,##") &amp;amp; "&lt;BR /&gt;&amp;lt;/text&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure= SVG_Bar('store'[storeID],[M.KPI],"Deepskyblue")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Progress_Bar =&lt;BR /&gt;(PctMeasure:numeric,Color:string)=&amp;gt;&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' width='200' height='30'&amp;gt;&lt;BR /&gt;&amp;lt;path id='wujunmin' d='M0 15L200 15' stroke='" &amp;amp; Color &amp;amp; "' stroke-opacity='0.4' stroke-width='10' stroke-dasharray='2'/&amp;gt;&amp;lt;path d='M0 15L" &amp;amp; 200 * PctMeasure &amp;amp; " 15' stroke='" &amp;amp; Color &amp;amp; "' stroke-width='10'/&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= SVG_Progress_Bar([M.Pct],"brown")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Gradient_Bar =&lt;BR /&gt;(ColumnForBar:anyref,MeasureForBar:numeric expr,Color:string)=&amp;gt;&lt;BR /&gt;VAR MaxValue =&lt;BR /&gt;MAXX ( ALLSELECTED(ColumnForBar), MeasureForBar)&lt;BR /&gt;VAR LinearGradient= "&lt;BR /&gt;&amp;lt;defs&amp;gt;&lt;BR /&gt;&amp;lt;linearGradient id='wujunmin'&amp;gt;&lt;BR /&gt;&amp;lt;stop offset='0%' style='stop-color:white'/&amp;gt;&lt;BR /&gt;&amp;lt;stop offset='100%' style='stop-color:" &amp;amp; Color &amp;amp; "'/&amp;gt;&lt;BR /&gt;&amp;lt;/linearGradient&amp;gt;&lt;BR /&gt;&amp;lt;/defs&amp;gt;"&lt;BR /&gt;VAR SVG = "&lt;BR /&gt;data&amp;amp;colon;image/svg+xml;utf8,&lt;BR /&gt;&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' width='200' height='30' &amp;gt; " &amp;amp;&lt;BR /&gt;LinearGradient &amp;amp; "&lt;BR /&gt;&amp;lt;rect rx='2' x='0' y='5' width='" &amp;amp; 200 * MeasureForBar / MaxValue &amp;amp; "' height='20'&lt;BR /&gt;fill='url(#wujunmin)'&lt;BR /&gt;/&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;BR /&gt;RETURN&lt;BR /&gt;SVG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= SVG_Gradient_Bar('Store'[StoreID],[M.KPI],"Brown")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Waffle =&lt;BR /&gt;(PctMeasure:numeric,Color:string)=&amp;gt;&lt;BR /&gt;VAR t =&lt;BR /&gt;GENERATESERIES ( 1, 10 )&lt;BR /&gt;VAR tPlus =&lt;BR /&gt;GENERATE ( SELECTCOLUMNS ( t, "Value1", [Value] ), t )&lt;BR /&gt;VAR tPlusPlus =&lt;BR /&gt;ADDCOLUMNS ( tPlus, "Index", RANKX ( tPlus, [Value] + [Value1] / 100,, ASC ) )&lt;BR /&gt;VAR tWaffle =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;tPlusPlus,&lt;BR /&gt;"circle",&lt;BR /&gt;"&amp;lt;circle cx='" &amp;amp; [Value] * 10 -5 &amp;amp; "' cy='" &amp;amp; [Value1] * 10 -5 &amp;amp; "' r='4' fill='"&lt;BR /&gt;&amp;amp; IF ( [Index] &amp;lt;= ROUND (PctMeasure * 100, 0 ), Color , "LightGrey" ) &amp;amp; "' /&amp;gt;")&lt;BR /&gt;RETURN&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='100' height='100'&amp;gt;&lt;BR /&gt;&amp;lt;g transform='rotate(-90,50,50)'&amp;gt;" &amp;amp; CONCATENATEX ( tWaffle, [circle] ) &amp;amp; "&amp;lt;/g&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt; "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;Measure = SVG_Waffle([M.Pct],IF([M.Pct]&amp;lt;0.5,"Brown","green"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Bubble =&lt;BR /&gt;(ColumnForBubble:anyref,MeasureForBubble:numeric expr,Color:string)=&amp;gt;&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='200' height='200'&amp;gt;&lt;BR /&gt;&amp;lt;circle cx='100' cy='100' r='" &amp;amp; 100 * SQRT ( ABS ( MeasureForBubble ) / MAXX ( ALLSELECTED ( ColumnForBubble ), ABS ( MeasureForBubble ) ) ) &amp;amp; "' fill='" &amp;amp; Color &amp;amp; "'/&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= SVG_Bubble('Store'[StoreID],[M.KPI],"Deepskyblue")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---------------&lt;BR /&gt;HTML UDFs(HTML Content Visual)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION HTML_CircleBG_Text=&lt;BR /&gt;(AnyText:string,BackgroundColor:string,TextColor:string)=&amp;gt;&lt;BR /&gt;"&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;p {&lt;BR /&gt;font-size: 30px;&lt;BR /&gt;color: white;&lt;BR /&gt;font-weight: bold;&lt;BR /&gt;line-height: 1;&lt;BR /&gt;font-family: Arial, sans-serif;&lt;BR /&gt;}&lt;BR /&gt;.wujunmin {&lt;BR /&gt;background-color: " &amp;amp; BackgroundColor &amp;amp; ";&lt;BR /&gt;border-radius: 50%;&lt;BR /&gt;margin: 3px;&lt;BR /&gt;width: 60px;&lt;BR /&gt;height: 60px;&lt;BR /&gt;color: " &amp;amp; TextColor &amp;amp; ";&lt;BR /&gt;display: inline-flex;&lt;BR /&gt;align-items: center;&lt;BR /&gt;justify-content: center;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;p&amp;gt;" &amp;amp;&lt;BR /&gt;CONCATENATEX(&lt;BR /&gt;GENERATESERIES(1,LEN(AnyText)),&lt;BR /&gt;"&amp;lt;span class='wujunmin'&amp;gt;" &amp;amp; MID(AnyText,[Value],1) &amp;amp; "&amp;lt;/span&amp;gt;",,[Value],ASC&lt;BR /&gt;) &amp;amp; "&amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;Measure = HTML_CircleBG_Text("wujunmin","Brown","Snow")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION HTML_Progress_Bar =&lt;BR /&gt;(ColumnForPct:anyref,PctMeasure:numeric,Color:string)=&amp;gt;&lt;BR /&gt;"&amp;lt;p style='font-size: 20px;background: linear-gradient(to right, " &amp;amp; Color &amp;amp; " " &amp;amp; FORMAT(PctMeasure,"0%") &amp;amp; ", lightgrey 0);border-radius: 20px;white-space: nowrap;padding-left:5px;'&amp;gt;" &amp;amp; SELECTEDVALUE(ColumnForPct) &amp;amp; " " &amp;amp; FORMAT(PctMeasure,"0%") &amp;amp; "&amp;lt;/p&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= HTML_Progress_Bar('Store'[StoreID],[M.Pct],"tomato")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION HTML_Bar_Ring =&lt;BR /&gt;(ColumnForChart:anyref,MeasureForBar:numeric expr,MeasureForRing:numeric)=&amp;gt;&lt;BR /&gt;VAR MaxSales = MAXX(ALLSELECTED(ColumnForChart), MeasureForBar)&lt;BR /&gt;VAR SalesPercentage = MeasureForBar / MaxSales * 100&lt;BR /&gt;VAR AchievementRate = MeasureForRing&amp;nbsp;&lt;BR /&gt;VAR CityName = SELECTEDVALUE(ColumnForChart)&lt;BR /&gt;VAR SalesFormatted = FORMAT(MeasureForBar, "#,#")&lt;/P&gt;&lt;P&gt;VAR DonutChart =&lt;BR /&gt;"&amp;lt;svg width='50' height='50' viewBox='0 0 42 42'&amp;gt;&lt;BR /&gt;&amp;lt;circle cx='21' cy='21' r='15' fill='none' stroke='lightgrey' stroke-width='4'/&amp;gt;&lt;BR /&gt;&amp;lt;circle cx='21' cy='21' r='15' fill='none' stroke='#2196F3' stroke-width='4'&lt;BR /&gt;stroke-linecap='round' stroke-dasharray='" &amp;amp; AchievementRate * 100 &amp;amp; ",100' transform='rotate(-90 21 21)'/&amp;gt;&lt;BR /&gt;&amp;lt;text x='21' y='26' font-family='Arial' font-size='10' text-anchor='middle' fill='#333'&amp;gt;" &amp;amp;&lt;BR /&gt;FORMAT(AchievementRate, "0%") &amp;amp; "&amp;lt;/text&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;BR /&gt;--公众号wujunmin&lt;BR /&gt;VAR BarChart =&lt;BR /&gt;"&amp;lt;div style='display: flex; align-items: center; width: 100%; gap: 10px;'&amp;gt;&lt;BR /&gt;&amp;lt;div style='flex-shrink: 0;'&amp;gt;" &amp;amp; DonutChart &amp;amp; "&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div style='flex-grow: 1; position: relative;'&amp;gt;&lt;BR /&gt;&amp;lt;div style='height: 30px; background: #f0f0f0; border-radius: 15px; overflow: hidden;'&amp;gt;&lt;BR /&gt;&amp;lt;div style='height: 100%; width: " &amp;amp; SalesPercentage &amp;amp; "%; background: linear-gradient(90deg, #2196F3, #64B5F6);&lt;BR /&gt;border-radius: 15px 0 0 15px; display: flex; align-items: center; padding-left: 15px;&lt;BR /&gt;color: white; font-family: Arial; font-weight: bold; font-size: 15px;'&amp;gt;&lt;BR /&gt;" &amp;amp; CityName &amp;amp; " " &amp;amp; SalesFormatted &amp;amp; "&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;"&lt;/P&gt;&lt;P&gt;RETURN BarChart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= HTML_Bar_Ring('Store'[StoreID],[M.Sales],[M.Pct])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Nov 2025 09:22:52 GMT</pubDate>
    <dc:creator>wujunmin</dc:creator>
    <dc:date>2025-11-06T09:22:52Z</dc:date>
    <item>
      <title>SVG HTML Charts UDFs</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SVG-HTML-Charts-UDFs/m-p/4867839#M185600</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Shape =&lt;BR /&gt;(IconIndex:numeric,Color:string)=&amp;gt;&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='48' height='48'&amp;gt;" &amp;amp;&lt;BR /&gt;SWITCH(IconIndex,&lt;BR /&gt;1,"&amp;lt;rect rx='24' x='0' y='0' width='48' height='48' fill='" &amp;amp; Color &amp;amp; "'/&amp;gt;",&lt;BR /&gt;2,"&amp;lt;rect rx='5' x='0' y='0' width='48' height='48' fill='" &amp;amp; Color &amp;amp; "'/&amp;gt;",&lt;BR /&gt;3,"&amp;lt;path d='M5.41421 22.5858L22.5858 5.41421C23.3668 4.63317 24.6332 4.63316 25.4142 5.41421L42.5858 22.5858C43.3668 23.3668 43.3668 24.6332 42.5858 25.4142L25.4142 42.5858C24.6332 43.3668 23.3668 43.3668 22.5858 42.5858L5.41421 25.4142C4.63317 24.6332 4.63316 23.3668 5.41421 22.5858Z' fill='" &amp;amp; Color &amp;amp; "'/&amp;gt;",&lt;BR /&gt;4,"&amp;lt;circle cx='24' cy='24' r='20' stroke='" &amp;amp; Color &amp;amp; "' fill='none' stroke-width='2'/&amp;gt;") &amp;amp; "&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= SVG_Shape(3,if([M.KPI]&amp;gt;=0.5,"green","rgb(255,0,0)"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Text_Icon =&lt;BR /&gt;(TextIcon:string,BackgroundColor:string,FontColor:string)=&amp;gt;&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='96' height='96'&amp;gt;&lt;BR /&gt;&amp;lt;rect rx='5' x='0' y='0' width='96' height='96' fill='" &amp;amp; BackgroundColor &amp;amp; "'/&amp;gt;&lt;BR /&gt;&amp;lt;text x='48' y='48' text-anchor='middle' dominant-baseline='central' font-size='60' fill='" &amp;amp; FontColor &amp;amp; "'&amp;gt;" &amp;amp;&lt;BR /&gt;TextIcon &amp;amp; "&amp;lt;/text1&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;Measure = SVG_Text_Icon(IF([M.KPI]&amp;gt;=1,"A","B"), IF([M.KPI]&amp;gt;=1,"green","red") ,"snow")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Rank =&lt;BR /&gt;(ColumnRank:anyref,MeasureRank:numeric expr,BackgroundColor:string)=&amp;gt;&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='96' height='96'&amp;gt;&lt;BR /&gt;&amp;lt;rect rx='48' x='0' y='0' width='96' height='96' fill='" &amp;amp; BackgroundColor &amp;amp; "'/&amp;gt;&lt;BR /&gt;&amp;lt;text x='48' y='48' text-anchor='middle' dominant-baseline='central' font-size='60' fill='snow'&amp;gt;" &amp;amp;&lt;BR /&gt;RANKX(ALLSELECTED(ColumnRank),MeasureRank) &amp;amp; "&amp;lt;/text&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;&amp;nbsp;Measure = SVG_Rank('store'[storeID],[M.sales],"brown")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Bar =&lt;BR /&gt;(ColumnForBar:anyref,MeasureForBar:numeric expr,Color:string)=&amp;gt;&lt;BR /&gt;VAR MaxValue = MAXX(ALLSELECTED(ColumnForBar), MeasureForBar)&lt;BR /&gt;VAR Width = 280 * MeasureForBar / MaxValue&lt;BR /&gt;RETURN&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='300' height='36' &amp;gt;&lt;BR /&gt;&amp;lt;rect rx='2' x='10' y='16' width='280' height='4' fill='#f0f0f0'/&amp;gt;&lt;BR /&gt;&amp;lt;rect rx='2' x='"&amp;amp; (300-Width)/2 &amp;amp; "' y='12' width='" &amp;amp; Width &amp;amp; "' height='12'&lt;BR /&gt;fill='" &amp;amp; Color &amp;amp; "' stroke='none'/&amp;gt;&lt;BR /&gt;&amp;lt;text x='150' y='8' text-anchor='middle' font-size='11' fill='#333333'&amp;gt;&lt;BR /&gt;" &amp;amp; FORMAT(MeasureForBar,"#,##") &amp;amp; "&lt;BR /&gt;&amp;lt;/text&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure= SVG_Bar('store'[storeID],[M.KPI],"Deepskyblue")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Progress_Bar =&lt;BR /&gt;(PctMeasure:numeric,Color:string)=&amp;gt;&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' width='200' height='30'&amp;gt;&lt;BR /&gt;&amp;lt;path id='wujunmin' d='M0 15L200 15' stroke='" &amp;amp; Color &amp;amp; "' stroke-opacity='0.4' stroke-width='10' stroke-dasharray='2'/&amp;gt;&amp;lt;path d='M0 15L" &amp;amp; 200 * PctMeasure &amp;amp; " 15' stroke='" &amp;amp; Color &amp;amp; "' stroke-width='10'/&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= SVG_Progress_Bar([M.Pct],"brown")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Gradient_Bar =&lt;BR /&gt;(ColumnForBar:anyref,MeasureForBar:numeric expr,Color:string)=&amp;gt;&lt;BR /&gt;VAR MaxValue =&lt;BR /&gt;MAXX ( ALLSELECTED(ColumnForBar), MeasureForBar)&lt;BR /&gt;VAR LinearGradient= "&lt;BR /&gt;&amp;lt;defs&amp;gt;&lt;BR /&gt;&amp;lt;linearGradient id='wujunmin'&amp;gt;&lt;BR /&gt;&amp;lt;stop offset='0%' style='stop-color:white'/&amp;gt;&lt;BR /&gt;&amp;lt;stop offset='100%' style='stop-color:" &amp;amp; Color &amp;amp; "'/&amp;gt;&lt;BR /&gt;&amp;lt;/linearGradient&amp;gt;&lt;BR /&gt;&amp;lt;/defs&amp;gt;"&lt;BR /&gt;VAR SVG = "&lt;BR /&gt;data&amp;amp;colon;image/svg+xml;utf8,&lt;BR /&gt;&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' width='200' height='30' &amp;gt; " &amp;amp;&lt;BR /&gt;LinearGradient &amp;amp; "&lt;BR /&gt;&amp;lt;rect rx='2' x='0' y='5' width='" &amp;amp; 200 * MeasureForBar / MaxValue &amp;amp; "' height='20'&lt;BR /&gt;fill='url(#wujunmin)'&lt;BR /&gt;/&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;BR /&gt;RETURN&lt;BR /&gt;SVG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= SVG_Gradient_Bar('Store'[StoreID],[M.KPI],"Brown")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Waffle =&lt;BR /&gt;(PctMeasure:numeric,Color:string)=&amp;gt;&lt;BR /&gt;VAR t =&lt;BR /&gt;GENERATESERIES ( 1, 10 )&lt;BR /&gt;VAR tPlus =&lt;BR /&gt;GENERATE ( SELECTCOLUMNS ( t, "Value1", [Value] ), t )&lt;BR /&gt;VAR tPlusPlus =&lt;BR /&gt;ADDCOLUMNS ( tPlus, "Index", RANKX ( tPlus, [Value] + [Value1] / 100,, ASC ) )&lt;BR /&gt;VAR tWaffle =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;tPlusPlus,&lt;BR /&gt;"circle",&lt;BR /&gt;"&amp;lt;circle cx='" &amp;amp; [Value] * 10 -5 &amp;amp; "' cy='" &amp;amp; [Value1] * 10 -5 &amp;amp; "' r='4' fill='"&lt;BR /&gt;&amp;amp; IF ( [Index] &amp;lt;= ROUND (PctMeasure * 100, 0 ), Color , "LightGrey" ) &amp;amp; "' /&amp;gt;")&lt;BR /&gt;RETURN&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='100' height='100'&amp;gt;&lt;BR /&gt;&amp;lt;g transform='rotate(-90,50,50)'&amp;gt;" &amp;amp; CONCATENATEX ( tWaffle, [circle] ) &amp;amp; "&amp;lt;/g&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt; "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;Measure = SVG_Waffle([M.Pct],IF([M.Pct]&amp;lt;0.5,"Brown","green"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION SVG_Bubble =&lt;BR /&gt;(ColumnForBubble:anyref,MeasureForBubble:numeric expr,Color:string)=&amp;gt;&lt;BR /&gt;"data&amp;amp;colon;image/svg+xml;utf8,&amp;lt;svg xmlns='&lt;A href="http://www.w3.org/2000/svg" target="_blank"&gt;http://www.w3.org/2000/svg&lt;/A&gt;' id='wujunmin' width='200' height='200'&amp;gt;&lt;BR /&gt;&amp;lt;circle cx='100' cy='100' r='" &amp;amp; 100 * SQRT ( ABS ( MeasureForBubble ) / MAXX ( ALLSELECTED ( ColumnForBubble ), ABS ( MeasureForBubble ) ) ) &amp;amp; "' fill='" &amp;amp; Color &amp;amp; "'/&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= SVG_Bubble('Store'[StoreID],[M.KPI],"Deepskyblue")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---------------&lt;BR /&gt;HTML UDFs(HTML Content Visual)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION HTML_CircleBG_Text=&lt;BR /&gt;(AnyText:string,BackgroundColor:string,TextColor:string)=&amp;gt;&lt;BR /&gt;"&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;p {&lt;BR /&gt;font-size: 30px;&lt;BR /&gt;color: white;&lt;BR /&gt;font-weight: bold;&lt;BR /&gt;line-height: 1;&lt;BR /&gt;font-family: Arial, sans-serif;&lt;BR /&gt;}&lt;BR /&gt;.wujunmin {&lt;BR /&gt;background-color: " &amp;amp; BackgroundColor &amp;amp; ";&lt;BR /&gt;border-radius: 50%;&lt;BR /&gt;margin: 3px;&lt;BR /&gt;width: 60px;&lt;BR /&gt;height: 60px;&lt;BR /&gt;color: " &amp;amp; TextColor &amp;amp; ";&lt;BR /&gt;display: inline-flex;&lt;BR /&gt;align-items: center;&lt;BR /&gt;justify-content: center;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/style&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;p&amp;gt;" &amp;amp;&lt;BR /&gt;CONCATENATEX(&lt;BR /&gt;GENERATESERIES(1,LEN(AnyText)),&lt;BR /&gt;"&amp;lt;span class='wujunmin'&amp;gt;" &amp;amp; MID(AnyText,[Value],1) &amp;amp; "&amp;lt;/span&amp;gt;",,[Value],ASC&lt;BR /&gt;) &amp;amp; "&amp;lt;/p&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;Measure = HTML_CircleBG_Text("wujunmin","Brown","Snow")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION HTML_Progress_Bar =&lt;BR /&gt;(ColumnForPct:anyref,PctMeasure:numeric,Color:string)=&amp;gt;&lt;BR /&gt;"&amp;lt;p style='font-size: 20px;background: linear-gradient(to right, " &amp;amp; Color &amp;amp; " " &amp;amp; FORMAT(PctMeasure,"0%") &amp;amp; ", lightgrey 0);border-radius: 20px;white-space: nowrap;padding-left:5px;'&amp;gt;" &amp;amp; SELECTEDVALUE(ColumnForPct) &amp;amp; " " &amp;amp; FORMAT(PctMeasure,"0%") &amp;amp; "&amp;lt;/p&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= HTML_Progress_Bar('Store'[StoreID],[M.Pct],"tomato")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;FUNCTION HTML_Bar_Ring =&lt;BR /&gt;(ColumnForChart:anyref,MeasureForBar:numeric expr,MeasureForRing:numeric)=&amp;gt;&lt;BR /&gt;VAR MaxSales = MAXX(ALLSELECTED(ColumnForChart), MeasureForBar)&lt;BR /&gt;VAR SalesPercentage = MeasureForBar / MaxSales * 100&lt;BR /&gt;VAR AchievementRate = MeasureForRing&amp;nbsp;&lt;BR /&gt;VAR CityName = SELECTEDVALUE(ColumnForChart)&lt;BR /&gt;VAR SalesFormatted = FORMAT(MeasureForBar, "#,#")&lt;/P&gt;&lt;P&gt;VAR DonutChart =&lt;BR /&gt;"&amp;lt;svg width='50' height='50' viewBox='0 0 42 42'&amp;gt;&lt;BR /&gt;&amp;lt;circle cx='21' cy='21' r='15' fill='none' stroke='lightgrey' stroke-width='4'/&amp;gt;&lt;BR /&gt;&amp;lt;circle cx='21' cy='21' r='15' fill='none' stroke='#2196F3' stroke-width='4'&lt;BR /&gt;stroke-linecap='round' stroke-dasharray='" &amp;amp; AchievementRate * 100 &amp;amp; ",100' transform='rotate(-90 21 21)'/&amp;gt;&lt;BR /&gt;&amp;lt;text x='21' y='26' font-family='Arial' font-size='10' text-anchor='middle' fill='#333'&amp;gt;" &amp;amp;&lt;BR /&gt;FORMAT(AchievementRate, "0%") &amp;amp; "&amp;lt;/text&amp;gt;&lt;BR /&gt;&amp;lt;/svg&amp;gt;"&lt;BR /&gt;--公众号wujunmin&lt;BR /&gt;VAR BarChart =&lt;BR /&gt;"&amp;lt;div style='display: flex; align-items: center; width: 100%; gap: 10px;'&amp;gt;&lt;BR /&gt;&amp;lt;div style='flex-shrink: 0;'&amp;gt;" &amp;amp; DonutChart &amp;amp; "&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div style='flex-grow: 1; position: relative;'&amp;gt;&lt;BR /&gt;&amp;lt;div style='height: 30px; background: #f0f0f0; border-radius: 15px; overflow: hidden;'&amp;gt;&lt;BR /&gt;&amp;lt;div style='height: 100%; width: " &amp;amp; SalesPercentage &amp;amp; "%; background: linear-gradient(90deg, #2196F3, #64B5F6);&lt;BR /&gt;border-radius: 15px 0 0 15px; display: flex; align-items: center; padding-left: 15px;&lt;BR /&gt;color: white; font-family: Arial; font-weight: bold; font-size: 15px;'&amp;gt;&lt;BR /&gt;" &amp;amp; CityName &amp;amp; " " &amp;amp; SalesFormatted &amp;amp; "&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;"&lt;/P&gt;&lt;P&gt;RETURN BarChart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. Measure&amp;nbsp;= HTML_Bar_Ring('Store'[StoreID],[M.Sales],[M.Pct])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2025 09:22:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SVG-HTML-Charts-UDFs/m-p/4867839#M185600</guid>
      <dc:creator>wujunmin</dc:creator>
      <dc:date>2025-11-06T09:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: SVG HTML Charts UDFs</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SVG-HTML-Charts-UDFs/m-p/4868573#M185622</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="318073" data-lia-user-login="wujunmin" class="lia-mention lia-mention-user"&gt;wujunmin&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for reaching out to the Microsoft Fabric Forum Community. I would recommend sharing this as a blog post to help it reach and benefit a wider audience using below link.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Power-BI-Community-Blog/bg-p/community_blog" target="_blank"&gt;Power BI Community Blog - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;
&lt;P&gt;Prasanna Kumar&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2025 02:36:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SVG-HTML-Charts-UDFs/m-p/4868573#M185622</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-11-07T02:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: SVG HTML Charts UDFs</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SVG-HTML-Charts-UDFs/m-p/4869588#M185662</link>
      <description>&lt;P&gt;Note that "&amp;amp;colon;"&amp;nbsp; needs to be unescaped back to ":" to make this all work.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2025 23:22:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SVG-HTML-Charts-UDFs/m-p/4869588#M185662</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-11-07T23:22:30Z</dc:date>
    </item>
  </channel>
</rss>

