Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
https://drive.google.com/drive/folders/1B4J-i9eTyTEmBX-c_AZd1OlyzR9gby4W
Hello Power BI Community,
I am facing a very persistent issue with a Top N report that seems to defy the normal behavior of DAX.
My Goal:
I need a report with two table visuals and a slicer for 'N'.
1. Table A should list the Top N travelers and their total spend.
2. Table B should automatically show the detailed transactions for ONLY that Top N group.
What I Did:
I have built a perfect data model from scratch with a clean data sample.
- A unique `Travelers` dimension table (the "1" side).
- A `Data` fact table (the "many" side).
- A correct 1-to-many, single-direction relationship.
- Two DAX measures:
- `Is Top Traveler`: Uses RANKX to identify the Top N (returns 1 or 0).
- `Top Traveler Spend`: Uses TOPN/KEEPFILTERS to calculate spend for only the Top N (returns BLANK for others).
How the Report is Built:
- Table A is filtered by `[Is Top Traveler] = 1`. This works perfectly.
- Table B is filtered by `[Top Traveler Spend]` is not blank. This is the part that fails.
The Problem:
In Table B, the rows do not filter. It continues to show all travelers. However, the grand total at the bottom of the table is correct and shows the sum for only the Top N travelers.
What We've Checked:
- Interactive filtering (manually clicking a name in Table A) works, so the relationship is correct.
- Visual interactions are set to "Filter".
- "Show items with no data" is turned off.
- We have tried this in a brand new file, and the problem persists.
Request:
I uploaded the PBIX file in a Google drive and shared the link above. Can someone please help ?
Thank you for your help.
Solved! Go to Solution.
You need to remove the filters from the ticket id column,
Top Traveler Rank =
VAR SelectedN = [Top N Selection Value]
VAR TravelerRank =
RANKX(
ALL(Travelers),
CALCULATE([Total Amount], REMOVEFILTERS( Data[Ticket Number] )),
,
DESC,
DENSE
)
RETURN
TravelerRank
You'd need to do the same thing in the Is Top Traveller measure, and then add [Is Top Traveller] to the detail table as a filter, to only show when the value is 1.
Hi @shabeercp659 ,
Thanks for reaching out to the Microsoft fabric community forum.
@johnt75 ,
Thanks for your prompt response
I wanted to check if you had the opportunity to review the information provided by @johnt75 , Please feel free to contact us if you have any further questions. If my response has addressed your query, please "Accept as Solution" so other members can easily find it.
Best Regards,
Lakshmi Narayana
You need to remove the filters from the ticket id column,
Top Traveler Rank =
VAR SelectedN = [Top N Selection Value]
VAR TravelerRank =
RANKX(
ALL(Travelers),
CALCULATE([Total Amount], REMOVEFILTERS( Data[Ticket Number] )),
,
DESC,
DENSE
)
RETURN
TravelerRank
You'd need to do the same thing in the Is Top Traveller measure, and then add [Is Top Traveller] to the detail table as a filter, to only show when the value is 1.
You can post a link to the PBIX on Google Drive, OneDrive or similar.
I have uploaded in a google drive and the link is now pasted in the original post
User | Count |
---|---|
17 | |
14 | |
13 | |
13 | |
11 |
User | Count |
---|---|
19 | |
15 | |
15 | |
11 | |
10 |