Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hey team,
I have a question on how to create a new date column with DAX.
I have a column with a certain start date and a second column that may or may not have an end date. I now wish to create a new end date column that has an end date two years from the start date, if the end date column is blank. If the end date column is not blank, then the end date remains the same. So the logic is essentially this:
New End Date =
IF(ISBLANK('Table'[End Date]),
+2 years from Start Date Column,
'Table'[End Date])
I have also visualised it:
Start Date | End Date | New End Date |
17/09/2020 | <blank> | 16/09/2022 |
14/10/2020 | 13/02/2023 | 13/02/2023 |
So as you can see, I'm a little lost when it comes to writing the +2 years from Start Date Column.
Solved! Go to Solution.
Hi, @Anonymous
Please try to write the below for creating a new column.
New End Date Column =
IF (
NOT ISBLANK ( 'Table'[End Date] ),
'Table'[End Date],
DATE ( YEAR ( 'Table'[Start Date] ) + 2, MONTH ( 'Table'[Start Date] ), DAY ( 'Table'[Start Date] ) )
)
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: https://www.linkedin.com/in/jihwankim1975/
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
newenddate =
IF (
ISBLANK ( 'Table'[End Date] ),
DATEADD ( 'Table'[Start Date], 2, YEAR ),
'Table'[End Date]
)
Proud to be a Super User!
Thanks so much both, your solutions have worked very well!
newenddate =
IF (
ISBLANK ( 'Table'[End Date] ),
DATEADD ( 'Table'[Start Date], 2, YEAR ),
'Table'[End Date]
)
Proud to be a Super User!
Hi, @Anonymous
Please try to write the below for creating a new column.
New End Date Column =
IF (
NOT ISBLANK ( 'Table'[End Date] ),
'Table'[End Date],
DATE ( YEAR ( 'Table'[Start Date] ) + 2, MONTH ( 'Table'[Start Date] ), DAY ( 'Table'[Start Date] ) )
)
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: https://www.linkedin.com/in/jihwankim1975/
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
User | Count |
---|---|
77 | |
77 | |
67 | |
65 | |
47 |
User | Count |
---|---|
108 | |
105 | |
93 | |
83 | |
65 |