I am stuck with a DAX if someone can help me.
I have a table with 2 date columns, Column A and Column B.
I want a new column (Column C) that will look and see if there is a value in Column A, if it is blank it picks up the value from Column B. If Column A isn't blank then it populates Column C with that value. As per the table below.
|Column A||Column B||Column C|
Solved! Go to Solution.
Hi there. You should consider do this in Power Query over the query editor. If you want DAX use the first answer, if you want power query try adding a custom column like this:
if [ColumnA] = "" then [ColumnB] else [ColumnA]
Just ask if columnA is blank and you can get the true false with the columns.
Hope this helps,
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.
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.
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.
130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.