Forum Discussion

RSSILVA_22's avatar
RSSILVA_22
Icon for Helper I rankHelper I
3 years ago

Top N plus others

I have a stacked 100% bar chart with "period" on the Y-axis, a simple measure with the sum of values on the X-axis, and "Plan" in the legend.

My challenge is: I need to create a chart that shows the top 5 plans, while the remaining plans should be classified as "Others".

The table has other fields, and in the example I posted, the group field is used as a filter in my report. Therefore, the classification of the top 5 plans + others needs to be dynamic based on the filter applied by the user on the dashboard.

Does anyone have a suggestion for a measure or any other solution for this scenario?

Thank you in advance.

 

Arquivo pbix

 

2 Replies

  • Martin_D's avatar
    Martin_D
    Icon for Solution Sage rankSolution Sage

    This is the solution you need: https://www.youtube.com/watch?v=JLK2e0k8OBE

    The key is to build a second table that consists of the plano values plus one more row with value "Other", then build a one to many relationship from new plano table to existing table and write the measure like in the video to sum all others in the others category.

     

    // Create new calculated table
    plano = UNION ( ROW ( "plano", "Other"), VALUES ( 'teste'[plano] ) )

     

     

    • RSSILVA_22's avatar
      RSSILVA_22
      Icon for Helper I rankHelper I

      In my source file, I already have a relationship with another table involving the same field that doesn't allow me to relate the two, which is a great solution, but it was not applicable in the production file.