Forum Discussion
Top N selection based on filter
- 7 years ago
hi, Anonymous
First, you should know that calculated column and calculate table can't be affected by any slicer. you could create a measure instead of column.
Notice:
1. Calculation column/table not support dynamic changed based on filter or slicer.
2. Measure can be affected by filter/slicer, so you can use it to get dynamic summary result.
here is reference:
https://community.powerbi.com/t5/Desktop/Different-between-calculated-column-and-measure-Using-SUM/t...
https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/Second, based on your measure, you could add a what if parameter as a slicer.
Then add a measure
TopN = IF([Rank]<=[Parameter Value],[Rank])
Here is a simple sample pbix file, please try it.By the way, your measureRank = RANKX(ALL(carrier_attributes),SUM(carrier_attributes[Call Limit]),,DESC)
is wrong, if this rank measure could meet you.Rank = RANKX(ALLSELECTED(carrier_attributes),CALCULATE(SUM(carrier_attributes[Call Limit])),,DESC)
Best Regards,
Lin
Hi
Columns in PowerBI are unaffected by slicers because they are pre-calculated when the dataset is refreshed. You will need to use a measure for this.
I created a measure based on carrier_attributes[Call Limit]:
Rank = RANKX(ALL(carrier_attributes),SUM(carrier_attributes[Call Limit]),,DESC)
But I think Measure cannot be used in a slicer. I want to display the number in a slicer so that the user can dynamically select the data and export the ppt.
- v-lili6-msft7 years ago
Community Support
hi, Anonymous
First, you should know that calculated column and calculate table can't be affected by any slicer. you could create a measure instead of column.
Notice:
1. Calculation column/table not support dynamic changed based on filter or slicer.
2. Measure can be affected by filter/slicer, so you can use it to get dynamic summary result.
here is reference:
https://community.powerbi.com/t5/Desktop/Different-between-calculated-column-and-measure-Using-SUM/t...
https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/Second, based on your measure, you could add a what if parameter as a slicer.
Then add a measure
TopN = IF([Rank]<=[Parameter Value],[Rank])
Here is a simple sample pbix file, please try it.By the way, your measureRank = RANKX(ALL(carrier_attributes),SUM(carrier_attributes[Call Limit]),,DESC)
is wrong, if this rank measure could meet you.Rank = RANKX(ALLSELECTED(carrier_attributes),CALCULATE(SUM(carrier_attributes[Call Limit])),,DESC)
Best Regards,
Lin