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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
bergen288
Helper IV
Helper IV

Top N filter with multiple categorical columns

I have a table visual with multiple categorical columns (Sponsor ID, Online Name, Subscriber ID, Last Name, Remit Center, Status) and descending sorted by Payment Amount as shown below.  I would like to list top 50 lines, how may I do it?  The "Top N" filter is good when there is only 1 categorical column.  But it doesn't work as expected with multiple categorical columns.

Thanks.

bergen288_1-1675367479601.png

 

2 REPLIES 2
amitchandak
Super User
Super User

@bergen288 , Try like

2 column top N = CALCULATE([Net], TOPN(10, SUMMARIZE(ALLSELECTED('Item'), 'Item'[Brand], 'Item'[Category]), [Net],DESC),VALUES('Item'[Brand]), VALUES('Item'[Category]) )

 

or

 

2 column top N = CALCULATE([Net], keepfilters( TOPN(10, SUMMARIZE(ALLSELECTED('Item'), 'Item'[Brand], 'Item'[Category]), [Net],DESC) ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

amitchandak:

I tried a simple table with 2 categorical columns first.  Below is my measure based on your 2nd suggestion: 

Top 10 by Tax ID and Name =
    VAR __AMT = SUM('PBI_XZ_Trial_Deposits_Final'[Amt])
    VAR __SUM = SUMMARIZE(ALLSELECTED('PBI_XZ_Trial_Deposits_Final'), 'PBI_XZ_Trial_Deposits_Final'[SBSR_TAX_ID], 'PBI_XZ_Trial_Deposits_Final'[SBSR_FULL_NAME])
    RETURN
    CALCULATE(__Amt, keepfilters( TOPN(10, __SUM, __Amt, DESC) ) )
 
However, it gives me the same result of 'PBI_XZ_Trial_Deposits_Final'[Amt].  The same is true for your 1st suggestion.  What's wrong with it?
Thanks.
bergen288_0-1675437949363.png

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors