Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Multiple group by/ranking issue

I have a faily simple data issue, which seems like it could be complicated in Power BI, but I'm a relative newbie so I'm hoping someone can point me in the right direction.   Here's the overview: I...
  • itsmebvk's avatar
    itsmebvk
    7 years ago


    Anonymous

     

    Here is what I am doing,

     

     

    1)Create a measure called "Rank Alarm Code" using following code :

     

    Rank Alarm Code = RANKX(ALLSELECTED(Sheet1[Alarm_Code]),CALCULATE(sum(Sheet1[Alarm_Count]),ALLSELECTED(Sheet1[Turbine])),, DESC) 

     


    2)Create another measure called "Rank Turbines" using following code :

     

    Rank Turbine = RANKX(ALLSELECTED(Sheet1[Turbine]),CALCULATE(SUM(Sheet1[Alarm_Count])))


    3)Create one more measure called "Total Alarms" using following code:

     

    Total Alarms = CALCULATE(SUM(Sheet1[Alarm_Count]),ALL(Sheet1[Turbine]))


    4) Filter (visual/Report/Page) on "Rank alarm Code"<=2

    5) Filter (visual/Report/Page) on "Rank Turbine"=1

    6)Add "Total Alarms" to the report.

     

    You should get output as shown in the screen shot.

     

     

    I am also trying to explore PowerBI more, please correct me if i misunderstood your requirement. I was unable to upload PBX as i don't have permissions.

  • Ashish_Mathur's avatar
    Ashish_Mathur
    7 years ago

    Hi,

     

    You may download my PBI file from here.  For Plant 2, AC3 should also show up because of a tie - 32 alarms.

     

    Hope this helps.

     

  • Anonymous's avatar
    Anonymous
    7 years ago

    Wow! This is fantastic, thank you so much!