Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
wujunmin
Advocate II
Advocate II

Dumbbell bar chart in table and matrix

Result:

wujunmin_1-1684291382294.png

Mark the SVG measure below as image URL:

 

 

表格哑铃图 = 
VAR MAX1 =
    MAXX ( ALL ( 'table' ), [M.今年] )
VAR MAX2 =
    MAXX ( ALL ( 'table' ), [M.去年] )
VAR W =
    IF ( MAX1 >= MAX2, MAX1, MAX2) 
VAR Value_Left= MIN ( [M.今年], [M.去年] )
VAR Value_Right=MAX ( [M.今年], [M.去年] )          
VAR Color_Circle_Left=IF ( [M.今年] <= [M.去年], "DeepSkyBlue", "Black" )
VAR Color_Circle_Right=IF ( [M.今年] > [M.去年], "DeepSkyBlue", "Black")
VAR Line="<line x1='" &  Value_Left / W*130+10 & "' y1='15' x2='" &  Value_Right / W*130+10 & "' y2='15'  style='stroke:DimGray;stroke-width:2' />"
VAR Circle_Left=
    "<circle cx='" &  Value_Left / W*130+10 & "' cy='15'  r='5'" & " fill='" & Color_Circle_Left & "'/>"
VAR Circle_Right=
     "<circle cx='" &  Value_Right / W*130+10 & "' cy='15'  r='5'" & " fill='" & Color_Circle_Right & "'/>"
VAR Bar =
        Line& Circle_Left & Circle_Right
VAR SVG = "data&colon;image/svg+xml;utf8," & "<svg xmlns='http://www.w3.org/2000/svg' height='30' width='150' >" & Bar  & "</svg>" 
RETURN
    SVG

 

 

0 REPLIES 0

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors