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
admin11
Memorable Member
Memorable Member

Expression to replace filter TOP N = 10 sales by Brand ?

Hi All,

 

My SALES YTD expression as below :-

Sales YTD = CALCULATE ( [SALES_M],DATESYTD('DATE'[Date]))

 

Now i am using filter to display Top 10 sales by Brand :-

 

admin11_0-1656279331341.png

May i know how to create a expression to replace above Top N filter on this visusal  ?

 

Sone thing like below , which is not work  :-

Flag Top 10 Brand = CALCULATE ( [SALES_M],DATESYTD('DATE'[Date],BRAND_5)TOP_N=10)

 

Paul Yeo

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Drag Brand 5 to the rows section of a Table visual and drag this measure

=calculate([Sales_m],Top(10,all(Data[Brand_5]),[Sales_m]),values(Data[Brand_5]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Drag Brand 5 to the rows section of a Table visual and drag this measure

=calculate([Sales_m],Top(10,all(Data[Brand_5]),[Sales_m]),values(Data[Brand_5]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Seanan
Solution Supplier
Solution Supplier

Hi @admin11 

You can create new table using the following code and replacing [Company] for Brand and [Measure4] with your SalesYTD measure.

The "Total Sales" is the column name so you can name that anything you want.

 

TestingTop10 = TOPN(10,SUMMARIZE('SalesTeam','SalesTeam'[Company],"Total Sales",'SalesTeam'[Measure 4]))

 

 Then go to the relationships page and create a relationship using the brand column.

NVIDIA_Share_tYePRU3XTV.png

 

 

 

 

 

 

 

Once done you can use the columns from your new table to return the top 10 brands and then the rest of your measures/columns can be used from the original table.

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.