Forum Discussion
Cannot Convert the Value #date(2027, 3, 31) to type Text Error in Custom Column
Hi all,
I have a custom column with the following formula:
if Text.Length([Option Effective Date]) = null then Date.AddMonths([Option Start Date], [Notice Period]) else [Option Effective Date]
I am trying to apply logic that says that is the [Option Effective Date] column doesn't have a date in it (it either does or just reads 'null') then take the date from column [Option Start Date] and advance the months by the number in column [Notice Period].
Else just use the date in the [Option Effective Date] column.
Dates are pulled through when the condition is true. However I get error in cells with the above error message for the Else logic.
What am I doing wrong?
In your case, Text.Length is not required. Hence, this would be enough.
= if [Option Effective Date] = null then Date.AddMonths([Option Start Date], [Notice Period]) else [Option Effective Date]
If you want to test for the presence of a date field
= if Value.Is(Date.From([Option Effective Date]), type date) then Date.AddMonths([Option Start Date], [Notice Period]) else [Option Effective Date]
1 Reply
- Vijay_A_VermaMost Valuable Professional
In your case, Text.Length is not required. Hence, this would be enough.
= if [Option Effective Date] = null then Date.AddMonths([Option Start Date], [Notice Period]) else [Option Effective Date]
If you want to test for the presence of a date field
= if Value.Is(Date.From([Option Effective Date]), type date) then Date.AddMonths([Option Start Date], [Notice Period]) else [Option Effective Date]