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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Show Top N values in Table

Hello, I am using Power BI Desktop with SSAS.   I have one table downloaded from a cube.

 

Table Name:  Intake.   I have an Intake Count and a Completed By column.   I am trying to create a column that will sum the top 10 "Completed By" people so I can display it using the top down filter visual.

 

I am having problems with the syntax.  I have reviewed articles re RankX, TopN, Summarize, etc. but I have not been able to nail down the syntax.   On one try I got a circular data issue.

 

Any help would be appreciated.

 

Thank you!

1 ACCEPTED SOLUTION

Are you adding it as a calculated column? (not a measure)?

 

And did you cut and paste all text, including brackets?

 

Here is a basic version of the data in a PBIX file you can download

 

https://1drv.ms/u/s!AtDlC2rep7a-oi4X3UW0fCQEVy16


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

8 REPLIES 8
Phil_Seamark
Employee
Employee

Hi @Anonymous

 

Do you have some sample data of what your table looks like?  


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

I don't seem to be able to cut and paste a snapshot of the columns.   Does this help?

 

TableName:      Intake

Column1:          Intake Count      Whole Number

Column2:         Completed By    Text

 

I am displaying the data for one year.

 

Hi @Anonymous

 

This calculated column, when added to your Intake table, will show the sum total of the top 10 values by [Intake].  If this is not exactly what you need, let me know and I will tweak the calculation for you 🙂

 

New Column = 
VAR myRank = TOPN(10,ALL('Intake'),[Intake Count],DESC)
RETURN SUMX(myRank,[Intake Count])

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

Hi Phil,

 

I receive:  The syntax for 'RETURN' is incorrect.   (DAX(.... your code string).

 

So yes, I would like the sum of the top 10 values and be able to display in a graph the "Completed By" names and values.

 

Thank you for your help by the way.

Are you adding it as a calculated column? (not a measure)?

 

And did you cut and paste all text, including brackets?

 

Here is a basic version of the data in a PBIX file you can download

 

https://1drv.ms/u/s!AtDlC2rep7a-oi4X3UW0fCQEVy16


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

You Rock!   Yes, the first try was my mistake!   That worked like a charm.  Thank you so much!   Really appreciate your help.

Cool,

 

I did have a typo in the original reply where I used a 3 instead of a 10, but I hope you picked that up 🙂

 

I've edited the original reply to show a 10 now.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

Your awesome.   I need to figure out how to cut and paste my Snagit screen captures in here.   This is the first forum I have participated in.  

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.