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.
Hello,
I'd like to create a DAX wich shows the value for the three months before the current one.
Example:
DATE VALUE
7th April 18
18th April 20
17th May 48
28th May 20
11th June 38
18th June 20
11th July 8
18th July 20
Because July is not over yet, I need the sum for the months April, May, June , therefore 164.
I have to put this measure in a line chart where I have my date on the x axis.
I tried this measure but the line chart is still showing July:
CALCULATE ([My Measure], all(Table_Date),
FIRSTDATE (
DATESINPERIOD (
Table_Date[Date],
LASTDATE ( Table_Date[Date]),
-3,
MONTH
)
)
)
Any ideas?
Thank you
Solved! Go to Solution.
@MCacc , when you use date table with max and lastdate and no date is selected, it can date the last date of the calendar
Try like
CALCULATE ([My Measure], all(Table_Date),
FIRSTDATE (
DATESINPERIOD (
Table_Date[Date],
eomonth(today() ,-1) ,
-3,
MONTH
)
)
)
Or
Last Month Today =
var _min = eomonth(today(),-2)+1
var _max = eomonth(today(),-1)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))
3rd Last Month Today =
var _min = eomonth(today(),-4)+1
var _max = eomonth(today(),-3)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))
Last 3 Months Today =
var _min = eomonth(today(),-4)+1
var _max = eomonth(today(),-1)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))
@MCacc , when you use date table with max and lastdate and no date is selected, it can date the last date of the calendar
Try like
CALCULATE ([My Measure], all(Table_Date),
FIRSTDATE (
DATESINPERIOD (
Table_Date[Date],
eomonth(today() ,-1) ,
-3,
MONTH
)
)
)
Or
Last Month Today =
var _min = eomonth(today(),-2)+1
var _max = eomonth(today(),-1)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))
3rd Last Month Today =
var _min = eomonth(today(),-4)+1
var _max = eomonth(today(),-3)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))
Last 3 Months Today =
var _min = eomonth(today(),-4)+1
var _max = eomonth(today(),-1)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))
Thank you! The last one worked just fine..
🙂
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 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |