Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I'm trying to create a column with a DAX formula that calculates a new date based on dates in another column. For context, I am calculating when a a device needs servicing. If the last servicing was 01-01-2022, it needs servicing again on 01-01-2025.
In short, I want to do:
new_date = old_date + 3 years.
I used the following formula:
However, this only gives an output if the new servicing date is already in the past. That can be the case for some unused devices. The rows where the new servicing date is in the future, remain blank. I need the future dates as well. How do I do that?
Solved! Go to Solution.
Dateadd function doesnot work for you as it takes the list of available dates from your date table.
For your requirement you can try creating a calculated column using the below pattern
DATE(Year(DateTable[Date]) + 3, Month(DateTable[Date]), Day(DateTable[Date])
you can also do this in power query using Date.AddYears function
https://learn.microsoft.com/en-us/powerquery-m/date-addyears
Dateadd function doesnot work for you as it takes the list of available dates from your date table.
For your requirement you can try creating a calculated column using the below pattern
DATE(Year(DateTable[Date]) + 3, Month(DateTable[Date]), Day(DateTable[Date])
you can also do this in power query using Date.AddYears function
https://learn.microsoft.com/en-us/powerquery-m/date-addyears
Thank you! I had tried that before, but I see I put the +3 in the wrong place. It works now.
User | Count |
---|---|
15 | |
13 | |
12 | |
10 | |
10 |
User | Count |
---|---|
19 | |
15 | |
14 | |
11 | |
10 |