Forum Discussion
DAX for date column
- 6 years ago
I'm sorry I forget to add the null cases too. Try this:
if [ColumnA] = "" or [ColumnA] = null then [ColumnB] else [ColumnA]Regards,
Hi,
Thanks for coming back to me. I'm now trying to do this in Power query but it hasn't worked. Using the add custom column option I have done:
= Table.AddColumn(#"Renamed Columns2", "Custom", each if[Column A]=""then[Column B]else[Column A])
and it isn't working. The only value that is returning in the new custom column is the value of column A.
Any ideas?
I'm sorry I forget to add the null cases too. Try this:
if [ColumnA] = "" or [ColumnA] = null then [ColumnB] else [ColumnA]
Regards,
- EmilyM20196 years agoHelper II
Thank you, this has worked, hurrah.
Just to build on this how would I do:
If column A and column B are blank then return todays date?
- ibarrau6 years agoSuper User
Well it should be similar
if [ColumnA] = "" or [ColumnA] = null then if [ColumnB] = "" or [ColumnB] = null then DateTime.LocalNow() else [ColumnB] else [ColumnA]You can continue adding if statements in the "then" or "else" in case you need them.
Regards,
- EmilyM20196 years agoHelper II
Thanks for your help.