Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
shabeercp659
Regular Visitor

Detail Table Won't Filter Automatically for Top N, Even When Grand Total is Correct

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.

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

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.

 

View solution in original post

5 REPLIES 5
v-lgarikapat
Community Support
Community Support

Hi @shabeercp659 , 

Thanks for reaching out to the Microsoft fabric community forum.

@johnt75 ,

Thanks for your prompt response

@shabeercp659 ,

 

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

johnt75
Super User
Super User

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.

 

Thanks @johnt75. This was super helpful!

johnt75
Super User
Super User

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

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.