Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I need a DAX measure that will return the month number of 2 months prior to the current month (so today is January, and the Month Number is 01, but I want the Dax measure to return the month number for 2 months ago, which would be 11)
In order to do this previously I was using this measure:
2MonthsAgo = FORMAT([Today],"mm")-2
However, now that we're in January and the month number is 1, it's giving me the incorrect value of -1 instead of 11. When we're in February, I need the measure to return 12 (the Month number for December).
My [Today] meausure is Today = NOW() so the data type is uncategorised.
Welcoming any suggestions for how I should get around this issue?
Solved! Go to Solution.
Hi @PhoenixBird66 ,
Please try:
Measure =
var now_month = MONTH(NOW())
return IF(now_month+10>12,now_month-2,now_month+10
)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @PhoenixBird66 ,
Please try:
Measure =
var now_month = MONTH(NOW())
return IF(now_month+10>12,now_month-2,now_month+10
)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@PhoenixBird66 , Use today function itself
2MonthsAgo = FORMAT(eomonth(date(today(),-2),"mm")
or
2MonthsAgo = month(eomonth(date(today(),-2))
Thanks for the suggestions. Sadly neither work for me.
When I try the either suggestion i get the error "Too few arguments were passed to the DATE function. The minimum argument count for the function is 3."
@PhoenixBird66 , My bad try like
2MonthsAgo = FORMAT(eomonth(today(),-2),"mm")
or
2MonthsAgo = month(eomonth(today(),-2))
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
75 | |
63 | |
51 | |
48 |
User | Count |
---|---|
204 | |
86 | |
64 | |
59 | |
56 |