Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hello all,
I am trying to achieve a report wherein I can filter the Top 5, Top 10, Top 15 based selection from a dropdown or slicer to show the top results of Zip code data based on number of employees. Below screenshot can help understand:
If you see above I need something similar like a dropdown or button can also help in this case - Like Top 5 Zip, Top 10 Zips, etc. I would need the selection to basically filter ZIP codes on the entire report.
Solved! Go to Solution.
Hi @Sashwato ,
Based on your description, I did a test. You can do some similar steps as follows.
1. Create a "Top N" table. (I use the "Enter Data" to create it.)
2. create a measure and drag it into the filter of the table visual.
Measure =
var x1=RANKX(ALL('Table'),CALCULATE(MAX('Table'[Value])),,DESC)
var x2=SELECTEDVALUE('Top N'[rank])
return
IF(x1<=x2,1,0)
Result:
Hope that's what you were looking for.
Best Regards,
Yuna
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Could you share some data to work with. Also, please show the expected result there.
Hi @Sashwato ,
Based on your description, I did a test. You can do some similar steps as follows.
1. Create a "Top N" table. (I use the "Enter Data" to create it.)
2. create a measure and drag it into the filter of the table visual.
Measure =
var x1=RANKX(ALL('Table'),CALCULATE(MAX('Table'[Value])),,DESC)
var x2=SELECTEDVALUE('Top N'[rank])
return
IF(x1<=x2,1,0)
Result:
Hope that's what you were looking for.
Best Regards,
Yuna
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You Need to Create Rank Function and Filter the Data based on Rank
You have a Slicer already which is showing 5,10,15 (Zip Codes) and let us assume the Column name of those 5,10,15 etc is [N]
Now use this code
VAR Rank of Zip = RankX(all(Table[Zip]), your measure )
RETURN
calculate(yourmeasure,filter(all(table[zip]),rank of zip <= [N]),distinct(zip))
This will give you the required information
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
75 | |
63 | |
51 | |
48 |
User | Count |
---|---|
211 | |
86 | |
64 | |
59 | |
56 |