Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
pani_victoria
Helper II
Helper II

sumx for 3 last year december

Hello!

So, please help

I have data with daily sales.
December is the most profitable month of the year and I want to calculate the growth rate to the previous month.

The calculation I want to do is as follows:

I take the sales for December and November for the last 3 years, then divide the sales of December by the sales of November and then average these 3 values

sumx decembers.JPG

 



How do I get the result in DAX?

I have a measure Sales_current
I have a measure Sales_previous month

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@pani_victoria , You can create measures to calculate the sales for December,November for the last 3 years.

DAX
Sales_December_Last3Years =
CALCULATE(
[Sales_current],
FILTER(
ALL('Date'),
'Date'[Month] = 12 &&
'Date'[Year] IN {YEAR(TODAY())-1, YEAR(TODAY())-2, YEAR(TODAY())-3}
)
)

 

Similarly do for November than

Growth_Rate_Per_Year =
DIVIDE(
[Sales_December_Last3Years],
[Sales_November_Last3Years],
0
)

 

In the end 

Average_Growth_Rate_Last3Years =
AVERAGEX(
VALUES('Date'[Year]),
[Growth_Rate_Per_Year]
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

5 REPLIES 5
Gabry
Super User
Super User

Hello,

based on the sample data you provided, this is the measure to get the job done

Measure = AVERAGEX('Table',CALCULATE(AVERAGEX('Table', DIVIDE(SUM('Table'[dec]),SUM('Table'[nov]))), 'Table'[year]=YEAR(TODAY())-1 || 'Table'[year]=YEAR(TODAY())-2 ||'Table'[year]=YEAR(TODAY())-3))
Let me know if it works for you 😉

@Gabry 
Thanks for your help, but
I don't know how to apply this formula because I don't have such a table in my data.
The table in the example is the result on the basis of which I wanted to show the calculation algorithm.

Hi,

If your question is still unanswered, then share some data to work with and show the expected result.  Do you want to see the result in a card visual?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
bhanu_gautam
Super User
Super User

@pani_victoria , You can create measures to calculate the sales for December,November for the last 3 years.

DAX
Sales_December_Last3Years =
CALCULATE(
[Sales_current],
FILTER(
ALL('Date'),
'Date'[Month] = 12 &&
'Date'[Year] IN {YEAR(TODAY())-1, YEAR(TODAY())-2, YEAR(TODAY())-3}
)
)

 

Similarly do for November than

Growth_Rate_Per_Year =
DIVIDE(
[Sales_December_Last3Years],
[Sales_November_Last3Years],
0
)

 

In the end 

Average_Growth_Rate_Last3Years =
AVERAGEX(
VALUES('Date'[Year]),
[Growth_Rate_Per_Year]
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






@bhanu_gautam 
your solution is perfect!
Thank you!!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.