Power BI 自定义华夫饼图案

2023-09-05 15:11:30 浏览数 (2)

华夫饼图常常用来展示百分比构成,以下视频讲解如何在Power BI内置卡片图自定义任意图案的华夫饼图,本方案同时适用于在表格矩阵展示:

电脑端可移步B站观看:

https://www.bilibili.com/video/BV1nk4y1V78s/

视频配套华夫饼度量值如下:

代码语言:javascript复制
华夫饼图任意图案 = 
VAR iconA = "A"
VAR iconB = "B"
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,
        "Icon",
            SUBSTITUTE (
                IF ( [Index] <= ROUND ( [M.业绩达成率] * 100, 0 ), iconA, iconB ),
                "data:image/svg xml;utf8,<svg",
                "<svg x='" & ( [Value] - 1 ) * 48 & "' y='" & ( [Value1] - 1 ) * 48 & "'"
            )
    )
VAR Chart =
    "data:image/svg xml;utf8,
    <svg xmlns='http://www.w3.org/2000/svg' height='480' width='480'>
    <g title='wujunmin'>"
        & CONCATENATEX ( tWaffle, [Icon] ) & "
    </g>
</svg> "
RETURN
    Chart

配套图标查询系统访问短网址:

https://douc.cc/2GQ1Ub

配套图标查询系统访问长网址:

https://app.powerbi.com/view?r=eyJrIjoiZDk1N2RiMTgtYWMwOC00ZDM3LTliYzQtYzMxYWYzOGVkNmI1IiwidCI6IjI5Y2JkNTY4LTBlOWItNDQ0Zi1iZTA1LTYxNjMyOTAzNjJmZSJ9

图标查询系统的其它用法:《Power BI 异常指标闪烁提示》《Power BI 自定义条形图图案6000种》

0 人点赞