Forum Discussion

mike_viz_lord's avatar
mike_viz_lord
Frequent Visitor
5 years ago

Filtering Bottom N Specialties by State Not Working

Sample dashboard: Here 

 

My goal is to display Top 5 Specialties by Loss Ratio when a user selects a State on the map. Also, I want to display Bottom 5 Specialties by Loss Ratio (only where Loss Ratio > 0) when a user selects that State.

 

My data source was at the individual policy # level, but I've removed that column. Loss Ratio is calculated at the policy level as INCURRED / EARNED_PREMIUM.

 

I created a calculated column to get Loss Ratio using the following: 

DIVIDE(Sheet1[INCURRED],Sheet1[EARNED_PREMIUM]). I then display Loss Ratio as an avg by State by Specialty. However, when trying to display Bottom 5 (for only Loss Ratios > 0), I don't get the results expected.
 
I then created a calculated measure to get Loss Ratio using the following:
DIVIDE(SUM(Sheet1[INCURRED]), SUM(Sheet1[EARNED_PREMIUM])). I then display Loss Ratio by State by Specialty. However, my Loss Ratios by State by Specialty are different than what the calculated column produced and I still don't get the results expected for Bottom 5 (for only Loss Ratios > 0).

 

I assume this is related to a lack of using the CALCULATE and/or FILTER functions, which is why I posted in this forum. I'm not educated enough in this area yet and wanted to see if anyone could assist. 

 

Thanks in advance!

3 Replies

  • mike_viz_lord , Try like


    Top 5 = CALCULATE([Loss Ratio]),TOPN(3,ALL ('Table'[Specialties]),[Loss Ratio],DESC),VALUES('Table'[Specialties]))

     

    or

    Specialties Rank = RANKX(all(Table[Specialties]),[Loss Ratio])
    TOP Quantity = avergageX(filter(VALUES(Table[Specialties]),[Specialties Rank]=1),[Loss Ratio])

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Icon for Community Champion rankCommunity Champion

    mike_viz_lord  this measure can get the same result

    Loss Ratio Calc2 = AVERAGEX(Sheet1,DIVIDE(Sheet1[INCURRED], Sheet1[EARNED_PREMIUM]))