How to Build a Multi-KPI Comparator Using Calculation Groups (Power BI DAX Tutorial)

As the name suggests, a multi-kpi comparator allows you to compare multiple KPIs or measures on the same chart. This way you can dramatically reduce the clutter on your Power BI report page.

You can select what measure you would like to see in bars for example and which one should go into a line. We use calculation groups to help us with dynamic formatting so that we can format each selection as $, % or whole numbers as a user makes his or her selections.

You can download the model here.

KPI Table Example:

KPIIDKPI FORMAT
SELECT KPI0
Sales1 \$#,0;(\$#,0);\$#,0
Units2#,0
Margin3 \$#,0;(\$#,0);\$#,0
Margin %4#,0.0%;-#,0.0%;#,0.0%
KPI1 = 
SWITCH(
    SELECTEDVALUE(KPI1[ID]),
    0, BLANK(),
    1, [Sales],
    2, [Units],
    3, [Margin],
    4, [Margin %]
)
Dynamic formatting Calculation Group example:

SWITCH(
    SELECTEDMEASURENAME(),
    "KPI1", SELECTEDVALUE('KPI1'[KPI FORMAT]),
    "KPI2", SELECTEDVALUE('KPI2'[KPI FORMAT]),
    SELECTEDMEASUREFORMATSTRING()
)

Leave a comment