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
afaque03
Helper I
Helper I

To get top month sales amount

Hi,

I Need Help as I want to display the top selling month. In the image given below as it displays top country (Country with highest selling amount).
In the same manner i want to display month with highest selling amount.

I have used the below mentioned DAX but it didn't worked.

TOP Month= RANKX(ALL(Date-Field),CALCULATE(SUM(Amount Field)))

top county.PNG

 

 

 

1 REPLY 1
KGrice
Memorable Member
Memorable Member

Hi @afaque03. We could probably help more directly with sample data or a little understanding of your data model (tables, relationships, etc.). I'm not sure of the way you're returning the top country, or why modifying that formula for returning the month won't work, but I'm assuming there's a reason.

 

That being said, you want to return the month for which monthly sales were at their highest? I just did something similar that could probably help.

 

Let's make some building block measures that will simplify things.

 

Calculate sales totals:

Sales = SUM(TableName[Sales])

 

 

Rank sales by month:

Monthly Sales Rank = RANKX(ALL(Calendar[Month], [Sales], , DESC, DENSE)

 

Identify the monthly sales amount where sales were highest:

Peak Monthly Sales = MAXX(ALLSELECTED(Calendar[Month]), [Monthly Sales Rank])

 

Determine the month where monthly sales are equal to the peak monthly sales:

Peak Month by Sales Rank = CALCULATE(
FIRSTNONBLANK(Calendar[Month], 1),
FILTER(VALUES(Calendar[Month]),
[Monthly Sales Rank]=CALCULATE(
[Peak Monthly Sales], VALUES(Calendar[Month])
)
)
)

 

If this is on the right track, you can find other examples and more info on powerpivotpro.

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.