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

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.

Reply
wujunmin
Advocate I
Advocate I

Add average line to bar chart (table & matrix)

Result:

wujunmin_1-1684290841973.png

Mark the SVG measure below as Image URL:

 

chart = 
VAR Max_Value = MAXX ( ALLSELECTED ('table'),[KPI] )
VAR Avg_Value = AVERAGEX ( ALLSELECTED ('table'),[KPI] )
VAR SVG ="
    data:image/svg+xml;utf8,
    <svg xmlns='http://www.w3.org/2000/svg' width='150' height='30'>
    <g>
        <title>公众号wujunmin</title>
        <rect x='0' y='5' width='"
            & 150 * [KPI] / Max_Value & "' height='20' 
            fill='deepskyblue'
        /> 
        <line x1='" & 150 * Avg_Value / Max_Value & "'
            x2='" & 150 * Avg_Value / Max_Value & "'
            y1='0' y2='30' 
            stroke-width='1' stroke='black' stroke-dasharray='5'
        />
    </g>
    </svg>"
RETURN
    SVG

 

 

0 REPLIES 0

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors