Forum Discussion
TopN
- 3 years ago
1-Create a meaasure:
SalesTotal = SUM(PersonRegionTable[sales])2-Create a rank measure:
RankMEasure = RANKX ( ALLSELECTED ( PersonRegionTable ), [SalesTotal] )3-Create a measure for your slicer value which is selected:
TOPNVALUE = SELECTEDVALUE(TOPNTABLE[VALUES])4-Create a measure as filter on the visual:
FILTERMeasure = IF ( [RankMEasure] <= [TOPNVALUE], 1, BLANK () )Then put the [FilterMeasure] on your Visual as Filter on this visual on FilterPane and set it equals to 1.
If this helps you, accept it as a solution.
Regards,
Loran
Hi MeghnaZutshi ,
If you use the Filter Pane TOPN option, it works as you expect.
Btw, if you need to use your approach, please share a sample .pbix then we can fix your measure.
Regards,
Loran
Hi MohammadLoran25 ,
Thanks for the solution. TOPN in filter pane works fine but i need TOPN to be based on the parameter chosen by the user in the slicer. I have attached my file, can you please help me with the solution .
- MeghnaZutshi3 years agoFrequent Visitor
MohammadLoran25
Not able to upload file here. here are my measures:TopN_SelectedValue =VAR SelectedTop= SELECTEDVALUE('Top N'[Top N])RETURNswitch(TRUE(),SelectedTop=0,[salesTotal],Rankx(ALLSELECTED('Sales_data'[Sales Person]),[salesTotal])<=SelectedTop,[salesTotal])Top N'[Top N] is the parameter nameI want a solution like this but without using TopN in filter pane:It should show region as well which is there in the legends
- MohammadLoran253 years agoSolution Sage
1-Create a meaasure:
SalesTotal = SUM(PersonRegionTable[sales])2-Create a rank measure:
RankMEasure = RANKX ( ALLSELECTED ( PersonRegionTable ), [SalesTotal] )3-Create a measure for your slicer value which is selected:
TOPNVALUE = SELECTEDVALUE(TOPNTABLE[VALUES])4-Create a measure as filter on the visual:
FILTERMeasure = IF ( [RankMEasure] <= [TOPNVALUE], 1, BLANK () )Then put the [FilterMeasure] on your Visual as Filter on this visual on FilterPane and set it equals to 1.
If this helps you, accept it as a solution.
Regards,
Loran
- MeghnaZutshi3 years agoFrequent Visitor
Hi MohammadLoran25
It worked as expected.
Thank you so very much!!