Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I am hardcore failing at making TOPN work in DAX instead of the filters on a visual. I have tried and looked at a million different things and ways of doing it in my real data set and this dummy sample I made, and failed at every step of the way, so am giving up for now and seeing if someone can show me what the correct way to do it is.
All I need is the proper DAX to make a measure that will return the TOPN for by Volume for a dummy data set like below.
My latest failure is:
Solved! Go to Solution.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
This appears to be the explanation I was looking for. I feel really dumb after seeing it, I blame being tired at the end of a day and week. Will post back in a little after I run it through the real data set.
Update: It works! Only problem having now in the real dataset is when I try to use a measure I have built that spits out what I want the TOPN to be (instead of using an actual number) it's funky and goes from sorting the top 95 when I use 'TOPN(95' to sorting the top 25 when I use 'TOPN([measure]' (but still keeps the total at the bottom of the table as the total of TOP95, but only showing TOP25 items, lol. Gonna do some reading and look into what is up, but I've triple checked the measure and it's spitting out a 95 everywhere else I use it.
If you check the documentation for TOPN (here and/or here), you may notice that it returns a table as its output, not a single value. A measure can only return a single value.
The easiest approach is usually to use the Top N filtering option in the filter pane.
See here too: https://community.powerbi.com/t5/Desktop/TopN/m-p/131646
Yeah, that's the easy way for us people in the office to do it. The goal is to make it go automatically by another measure that I have built to spit out a number for what I want the TOPN to be so on the user side they don't have to do anything and break the report or do god knows what. I wish in that TOPN i nthe filter pane I could just drag in the measure instead of having to manually input the number, but it is what it is.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
25 | |
20 | |
20 | |
14 | |
13 |
User | Count |
---|---|
43 | |
37 | |
25 | |
24 | |
22 |