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

Top Solution Authors