March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
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
How do I get the result in DAX?
I have a measure Sales_current
I have a measure Sales_previous month
Solved! Go to Solution.
@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]
)
Proud to be a Super User! |
|
Hello,
based on the sample data you provided, this is the measure to get the job done
@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?
@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]
)
Proud to be a Super User! |
|
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |