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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
wujunmin
Advocate I
Advocate I

McKinsey‘s waffle chart by DAX

wujunmin_2-1663809909429.png

 

Mark this measure as ImageURL and put it in table  or matrix

 

Waffle =
VAR t =
    GENERATESERIES ( 1, 10 ) 
VAR tPlus =
    GENERATE ( SELECTCOLUMNS ( t, "Value1", [Value] ), t ) 
VAR tPlusPlus =
    ADDCOLUMNS ( tPlus, "Index", RANKX ( tPlus, [Value] + [Value1] / 100,, ASC ) ) 
VAR tWaffle =
    ADDCOLUMNS (
        tPlusPlus,
        "circle",
            "<circle cx='" & [Value] * 10 + 15 & "' cy='" & [Value1] * 10 + 15 & "' r='4' fill='"
                & IF ( [Index] <= ROUND ( [percent] * 100, 0 ), "Black", "LightGrey" ) & "' />"
    ) 
VAR Chart =
    "data&colon;image/svg+xml;utf8," & "
    <svg xmlns='http://www.w3.org/2000/svg' width='150' height='150'>" & "
        <g transform='rotate(-90,75,75)'>"
            & CONCATENATEX ( tWaffle, [circle] ) & "
        </g>
        <text x='70' y='20' font-size='15' text-anchor='middle' >"
            & ROUND ( [percent] * 100, 0 ) & "</text>
        <text x='70' y='148' font-size='15' text-anchor='middle' >"
            & SELECTEDVALUE ( 'table'[store] ) & "</text>
    </svg> "
RETURN
    IF ( HASONEVALUE ( 'table'[store] ), Chart, BLANK () )

 

1 REPLY 1
elimcd79
Advocate II
Advocate II

This was exactly what I needed - thank you!!!!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors