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 2 questions on how to created the following DAX True/False statement. If I want to filter create filter on data for last year I created the following statement:
Solved! Go to Solution.
1) Last 365 days = IF(
DATEDIFF('# Calendar'[Date], TODAY()-90, DAY) <= 365, "TRUE", "FALSE")
2) New column =
var _date = date(year(today()), month(Today())-3, day(today()))
var _month = mod(month(_date,3)
var _qt = Switch(_month , 0, eomonth(_date,0), 1, eomonth(_date,2), 2, eomonth(_date,1))
return
if('# Calendar'[Date] <=_qt && '# Calendar'[Date] >= eomonth(_qt,-12)+1, "TRUE", "FALSE")
1) Last 365 days = IF(
DATEDIFF('# Calendar'[Date], TODAY()-90, DAY) <= 365, "TRUE", "FALSE")
2) New column =
var _date = date(year(today()), month(Today())-3, day(today()))
var _month = mod(month(_date,3)
var _qt = Switch(_month , 0, eomonth(_date,0), 1, eomonth(_date,2), 2, eomonth(_date,1))
return
if('# Calendar'[Date] <=_qt && '# Calendar'[Date] >= eomonth(_qt,-12)+1, "TRUE", "FALSE")
Hi amitchandak,
Thanks for reply. On point 1) Your answer is where I was stuck also but does not give correct answer.
This formula gives indeed a 90 day lag to the year ago (so False value is pushed back 90 days to 15/11/2019. However it still gives for the most recent 90 days before today the value "TRUE" and that is what needs to be "False" also (so today only the dates 15/11/2021 till 15/11/2019 should only be "TRUE" and currently gives 12/2/2021 till 15/11/2019 as "TRUE".
In addition I ideally want future dates to be carrying the "False"value also, which is not the case right now.
Hi amitchandak, @amitchandak
Thanks for your support. Still hoping to get anser to resolve point 1)... Did you manage to look into this?
On point 1) Your answer is where I was stuck also but does not give correct answer.
This formula gives indeed a 90 day lag to the year ago (so False value is pushed back 90 days to 15/11/2019. However it still gives for the most recent 90 days before today the value "TRUE" and that is what needs to be "False" also (so today only the dates 15/11/2021 till 15/11/2019 should only be "TRUE" and currently gives 12/2/2021 till 15/11/2019 as "TRUE".
In addition I ideally want future dates to be carrying the "False"value also, which is not the case right now.
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 |
---|---|
49 | |
25 | |
20 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
44 | |
18 | |
18 |