Forum Discussion

ExcelUnplugged's avatar
ExcelUnplugged
Frequent Visitor
10 years ago

KPI Statuses in a Switch formula

Hi,

 

In PowerBIDesktop or Excel

 

how can you write a DAX SWITCH formula that would switch over Statuses of different KPI's. So sort of

 

=SWITCH( [SwitchMeasure], [StatusOoKPIOne, [StatusOfKPITwo],...)

 

where KPI's were imported from Excel...

 

So to see the icons for the selected measure...

 

3 Replies

    • ExcelUnplugged's avatar
      ExcelUnplugged
      Frequent Visitor

      Ok, so in a Data Model in Excel you have a bunch of measures and a bunch of KPI-s defined for those measures.

      And then, instead of vasting many columns of valuable workspace, you use a disconected slicer method, so that you can easily change the calculation (so still have them all available), you wish to see and only use one column of real estate

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      Now with calculations this works great... My question however is, if you can write a magic SWITCH formula (or use another function) to use only one column on the KPI statuses (the icons).. Something like

       

       

       

       

       

       

       

      but with some sort of magic dust :) 

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI ExcelUnplugged, You can indeed do this in DAX, it works in Power BI, where you defined the KPI in separate measures, and chain them together in a single switch statement, based on a table of measure names (this config is a bit manual but it works). 

        The Selected Measure is a Measure over a list of measures : Selected Measure = SELECTEDVALUE('Measure Table'[Measure Column])

         
        Individual KPIs look like this: 
        Store Performance KPI =
        IF('Availability Ratio Measures'[Store Performance] < 0.8, "0",
        IF('Availability Ratio Measures'[Store Performance] < 0.9, "1",
        "2")
        )
         

        Then the flexible KPI is: 

        Flexi KPI = SWITCH([Selected Measure],
        "Store Performance", [Store Performance KPI]
        ) - you can include more measures and only format selected columns using your KPIs.