Forum Discussion
Top N in Table or Matrix Table
Top N measures work great on bar charts.
How do we make them work on Tables or Matric Tables?
Hi bdehning ,
You need to have a slicer to select the value of N and create two measures for this purpose
1. The Value of N can be selected using either a What if Parameter option or using a table of values. I would recommend using a What if Parameter option
2. A Measure to Rank the column. The DAX you can use for this purpose is below
Top_ranks = RANKX(ALLSELECTED(TableName[Column Name]), [Column to be ranked], ,DESC,Dense)Note:Column Name will be the dimension columnColumn to be ranked will be the measure column or an expression based on a column3. A Measure to define which columns to consider based on the Parameter selection for NRows_to_consider = IF([Top_ranks] <= SELECTEDVALUE(Parameter[Parameter]), 1, 0)4. Add this Rows_to_consider measure as a visual filter to the visual and select 1 as the default valueRegards,
1 Reply
- ThejeswarSuper User
Hi bdehning ,
You need to have a slicer to select the value of N and create two measures for this purpose
1. The Value of N can be selected using either a What if Parameter option or using a table of values. I would recommend using a What if Parameter option
2. A Measure to Rank the column. The DAX you can use for this purpose is below
Top_ranks = RANKX(ALLSELECTED(TableName[Column Name]), [Column to be ranked], ,DESC,Dense)Note:Column Name will be the dimension columnColumn to be ranked will be the measure column or an expression based on a column3. A Measure to define which columns to consider based on the Parameter selection for NRows_to_consider = IF([Top_ranks] <= SELECTEDVALUE(Parameter[Parameter]), 1, 0)4. Add this Rows_to_consider measure as a visual filter to the visual and select 1 as the default valueRegards,