SVG Image not populating

Hi, I am trying to add an SVG image to a card visual and it is not working. Can someone see what the issue could be. Below is the DAX. I have set the Data category to Image URL so I don’t know what the issue could be. Thanks in advance.

Area Sparkline =
// Line and area colours - use %23 instead of # for Firefox compatibility (Measure Derived from Eldersveld Modified by Kolosko)

// “Date” field used in this example along the X axis
VAR XMinDate = MIN(_DateTable[Date])
VAR XMaxDate = MAX(_DateTable[Date])

// Obtain overall min and overall max measure values when evaluated for each date
VAR YMinValue = MINX(Values(_DateTable[Date]),CALCULATE([Implicit Lead Score Count]))
VAR YMaxValue = MAXX(Values(_DateTable[Date]),CALCULATE([Implicit Lead Score Count]))

// Build table of X & Y coordinates and fit to 50 x 150 viewbox
VAR SparklineTable = ADDCOLUMNS(
SUMMARIZE(_DateTable, _DateTable[Date]),
“X”,INT(150 * DIVIDE(_DateTable[Date] - XMinDate, XMaxDate - XMinDate)),
“Y”,INT(50 * DIVIDE([Implicit Lead Score Count] - YMinValue,YMaxValue - YMinValue)))

// Concatenate X & Y coordinates to build the sparkline
VAR Lines = CONCATENATEX(SparklineTable,[X] & “,” & 50-[Y]," ", _DateTable[Date])

// Add to SVG, and verify Data Category is set to Image URL for this measure
VAR SVGImageURL =
“data:image/svg+xml;utf8,” &
“” &
“”

RETURN SVGImageURL

ysherriff.pbix (8.6 MB)

the SVGImageURL variable doesn’t have an SVG specification

Here is the full code and I have attached the PBX file as well. Thanks David. It still doesn’t work.

The SVG code came from

Hi @ysherriff ,

Just need more adjustment in DAX formula to catch the right table - see in pbix

ysherriff_2.pbix (8.6 MB)

to catch

image

Hope this helps and what are you looking for.

1 Like

Thank you Maja. But this does not work when I put it in a card visual. I am using the new card visual to test. See image below.

In their tutorial below - there are only table visuals :

but you can add a separate one

image

format a little bit and position below card visual.

Or put both in a table and format a little bit as you need

image

It’s not ideal

Hi maja,

Look at the below videos based on the new card visual. It is using the same source from Kerry’s.You can add it in the new card visual that was released a couple of months ago.

(12) How to use the New Card visual in Power BI - YouTube

(12) NEW Card Visual - Power BI Report Design Episode 12 - YouTube

1 Like

Hi @ysherriff ,

Yes, you are right - trick is to move Size from Auto or 0 to large one (under Image - > Size ) - like

image

and here it is :

image

you can switch positions and sizes but you need to increase it to make it visible :slight_smile:

1 Like

Thank you very much. I reached out to Kerry Koloso and she said the same thing.

Thanks Maja.

1 Like