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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
bergen288
Helper III
Helper III

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) ) )

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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