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
Palikaros
New Member

Sorting DAX measure of Current Year Actual net sales

Hello,

 

I have created the below DAX measure, where I am calculating current year net sales at Prior Year Rate for some products.

 

CY Actual Net Sales at PY = CALCULATE([CY Actual at PY], 'Report Line'[Report_Line_Parent]="Net Sales").
 
Is it possible with a DAX measure to create the top 5 of the above with descending order? Of course, values should be dynamic based on user`s selection of country and quarter, which are done through slicers.
 
I know that it is possible to do sorting within a visual, but since i want to sort the visual also per year, i would like to have already sorted the top 5 products with descending order from a DAX measure.
 
Thank you in advance.
1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

yes, you shall check the TOPN function, but it returns a table instead of a scalar value. You may aggregate based on the TOPN table. 

https://dax.guide/topn/

View solution in original post

1 REPLY 1
FreemanZ
Super User
Super User

yes, you shall check the TOPN function, but it returns a table instead of a scalar value. You may aggregate based on the TOPN table. 

https://dax.guide/topn/

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.