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
Lily36876
Helper II
Helper II

How to ranking sales with clients and each month

Hello everyone,

Originally, I only needed to rank the sales amount BY Client in my report. So, I used this DAX formula:

AMT Rank = RANKX( ALLSELECTED('Sales'[Customer Name]), 'Sales'[1. Actual Sales Amount], , DESC )

 

But now, I need to view their rankings by YearMonth .

How should I modify my formula for this?

Please provide me with some advice. Thank you.

 

My ideal format looks like the following: 

Lily36876_1-1698987705153.png


And this is a simple data model

Lily36876_2-1698987741072.png

 

 

4 REPLIES 4
BeaBF
Impactful Individual
Impactful Individual

@Lily36876 Try with:

AMT Rank =
RANKX(
FILTER(
ALLSELECTED('Sales'[Customer Name]),
'Sales'[YearMonth] = MAX('Sales'[YearMonth])
),
'Sales'[1. Actual Sales Amount],
,
DESC
)


BBF

Hello!!! Thanks for reply~

I'm try it,but my 'Sales'[YearMonth] = MAX('Sales'[YearMonth]) show error,

because 'Sales'[YearMonth]  properties is column not a measure.

BeaBF
Impactful Individual
Impactful Individual

@Lily36876 the code is for a calculated olumn, not a measure. Try.

 

BBF

VahidDM
Super User
Super User

Hi @Lily36876 

As your data model is the Sales Table filter the Date table?

Can you share sample of your data in text format or PBIX file here?

What is the expected output? in the ideal image you shares, the rak is 1 for all items

BTW, check this, it's quick similar to your case:https://community.fabric.microsoft.com/t5/Desktop/Rank-sales-value-grouped-by-month-and-year/m-p/330...

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

Badges.jpg

LinkedIn | Twitter | Blog | YouTube 

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.