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.
Hi All,
I have a requirement to create a DAX calculation of the Last 12 Months' ARR.
For E.g. For the month of June-2021, a report with a Rolling Year would report on data from June 2020 - May 2021 which I am able to achieve using below DAX and output as shown in the screenshot.
DAX Formula:
Now, what I want is to show the Last 12 Months' ARR only up to the end of the previous month.
As we should not report on an incomplete month so, like in the above example, as we are still in the month of July 2021, we would not include July 2021 data.
Solved! Go to Solution.
Hi @Anonymous ,
Modify your measure as below:
Last 12 Months ARR =
VAR EndDate = EOMONTH(MIN('Transaction Date'[Date Key]),-1)
var enddate2=EOMONTH(TODAY(),-1)
RETURN
IF(MAX('Transaction Date'[Date Key])<=enddate2,
CALCULATE (
SUM('Transaction'[Total Revenue]),
FILTER( ALL('Transaction'),
AND(
'Transaction'[Transaction Date Key] <= EndDate ,
'Transaction'[Transaction Date Key]>=MINX(DATEADD('Transaction Date'[Date Key],-12,Month),'Transaction Date'[Date Key]) ))))
And you will see:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Hi @Anonymous ,
Modify your measure as below:
Last 12 Months ARR =
VAR EndDate = EOMONTH(MIN('Transaction Date'[Date Key]),-1)
var enddate2=EOMONTH(TODAY(),-1)
RETURN
IF(MAX('Transaction Date'[Date Key])<=enddate2,
CALCULATE (
SUM('Transaction'[Total Revenue]),
FILTER( ALL('Transaction'),
AND(
'Transaction'[Transaction Date Key] <= EndDate ,
'Transaction'[Transaction Date Key]>=MINX(DATEADD('Transaction Date'[Date Key],-12,Month),'Transaction Date'[Date Key]) ))))
And you will see:
For the related .pbix file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Hi @v-kelly-msft,
Thanks for replying and thank you for your efforts, this has solved my requirement.
Hi @Ashish_Mathur , @parry2k
Here is the link to the sample data.
https://drive.google.com/file/d/1mXThN2dBPnUV5hjrjK0OYk_als_Pj1P6/view?usp=sharing
Please let me know if anything is not clear or if you need more information.
Thanks in Advance!
Hi,
I believe @v-kelly-msft has already answered your question.
Hi, @Ashish_Mathur,
Yes, @v-kelly-msft has answered my question.
Thank you for following up 👍
@Anonymous I'm still not clear what you are actually looking for. It is always a good idea to put a sample data file and explain the expected output. You know your requirement and data better than anyone else, better you explain, quicker the solution you get otherwise we can keep going in circles. cheers!!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Anonymous for any time intelligence, it is a best practice to have a calendar table in your model, you can add easily by following my blog post here Create a basic Date table in your data model for Time Intelligence calculations | PeryTUS IT Solutions
Once you have a table relationship with the calendar table, add the following DAX measure, replace the table and column name as per your data model:
Last 12 Months Upto Previous Month =
VAR __endMonth = EOMONTH ( TODAY(), -1 )
RETURN
CALCULATE (
SUM ( Sales[Sales] ),
KEEPFILTERS (
DATESINPERIOD (
'Calendar'[Date],
__endMonth,
-12,
MONTH
)
)
)
To visualize, use month from calendar table and above measure, and everything should work as expected.
✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi @parry2k,
Thank you for your answer,
here are my thoughts on this:
1) I do have a Transaction Date table which is similar to the Calendar table just that it's not created in PowerBI rather in the backend. But it has the Latest Transaction Date as of 12/31/2021 because of which I get July 2021 onwards data as well in the Last 12 Months' ARR DAX calculation.
2) An alternate approach to this is I have tried using date from my Transaction table which has the Latest Transaction Date as of todays' date i.e. 07/25/2021 which still gives me data till July 2021 as shown below.
So, I am not sure creating Calendar Table (especially only for this measure calculation) will help me in my case.
Also, I tried using your given DAX formula, but the result is not correct because we are using the Today() function which will show results only from July-2020 till June-2021 and not for all the months.
Hi,
I'd like to help but am not clear of what you want. Share the link from where i can download your PBI file and show the expected result clearly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |