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.
Im having an issue with my measure when it crosses years. Im trying to calculate my total purchase in a month 9 month from this month. I can calculate 2 or 3 months forward but when it transitions across years mess it up... How do I figure out what the date range should be in the month 9 months from this month?
Thanks all in advance
Like this
Measure =
var _max = today()
var _min = date(year(_max),month(_max)+9,day(_max))
return
calculate([measure],filter(All(DATE), Date[Date] >=_min && Date[Date] <=_max))
or
Measure =
var _max = eomonth(today(),-1)+1
var _min = eomonth(date(year(_max),month(_max)+9,1) ,0)
return
calculate([measure],filter(All(DATE), Date[Date] >=_min && Date[Date] <=_max))
or
Measure =
var _max = maxx(allselected('Date'),'Date'[Date])
var _min = date(year(_max),month(_max)+9,day(_max))
return
calculate([measure],filter(All(DATE), Date[Date] >=_min && Date[Date] <=_max))
Hi,
Try this measure
=Calculate([your_measure],datesbetween(Calendar[Date],Edate(Eomonth(Today(),-1)+1),9),Edate(Eomonth(Today(),0),9)))
Hope this helps.
Brilliant thank you so much. Had to make a slight adjustment as I think you have an extra parenth
You are welcome. If my reply helped, please mark it as Answer.
Have you tried DATEADD()? This assumes you have a date calendar named Calendar and it is Marked as Date Table.
Measure = Calculate([YourMeasure], DATEADD(Calendar[Date], 9, month))
If this works for you, please mark it as solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
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 |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |