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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Cyriackpazhe
Helper III
Helper III

TopN

Screenshot (4).pngScreenshot (5).pngHere it is a measure to produce the sales of top 2 products. Why is the TopN the products are arranged based on Product[Name]?? Shouldn't it be sorted based on the measure [total]. What is the correct way if i want topN sales in each continent?

3 REPLIES 3
bhanu_gautam
Super User
Super User

@Cyriackpazhe , RankProduct = RANKX(
ALLSELECTED(Product[Name]),
[TotalSales],
,
DESC,
DENSE
)

 

It must be using measure like this so it is sorting on the basis of Total Sales but listing it product name wise




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






In the topN , he he had written calculate( [total], TopN( 2, products, [total],ASC)) would the result be correct? If i sort by Product[Name], i won't be getting the products with the top sales right

@Cyriackpazhe  it sorts the products in ascending order based on the [total] measure, which means it will return the products with the lowest sales instead of the highest. For highest use Desc.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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