Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Just like SVG SparkLines this DAX produces a Trend indicator, Up/Down/Neutral.
Add it as a field in your table, keyed off a numeric value to give you the up/down/neutral.
One additional trick is to set the image size as small as possible (24) under Grid as part of the formatting.
Trend_Image =
VAR MessageText = ""
VAR Radius = 9
VAR Colour = "blue"
VAR Opacity = 0.75
VAR SVG_Neutral = "data:image/svg+xml;utf8," &
"<svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='50' height='20'>" &
"<circle cx='25' cy='10' r='" & Radius & "' fill='" & Colour & "' fill-opacity='" & Opacity & "' />" &
"</svg>"
VAR SVG_UP = "data:image/svg+xml;utf8," &
"<svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='50' height='20'>" &
"<polygon points=""05,20 45,20 25,1"" style=""fill:green;stroke:green;stroke-width:0;fill-rule:evenodd;"" />" &
"</svg>"
VAR SVG_DN = "data:image/svg+xml;utf8," &
"<svg xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' width='50' height='20'>" &
"<polygon points=""05,1 45,1 25,20"" style=""fill:red;stroke:red;stroke-width:0;fill-rule:evenodd;"" />" &
"</svg>"
RETURN
IF('Customer KPI'[KPI_Trend] > 0, SVG_UP, IF('Customer KPI'[KPI_Trend] < 0, SVG_DN, SVG_Neutral))
Thank you.
Yes an issue with copy & paste. and Having tried it again, the editor here is doing "fancy" stuff that I cannot work around.
The "magic" is attached in an image below.