cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

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.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.