Forum Discussion
Power Query (BI) replace date from another column
- Anonymous5 years ago
You may add a conditional column as below:
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
You could do this by inserting a new Custom Conditional Column.
IF [TransformedDate] equals null THEN Date
Else TransformedDate
The M code looks like this:
#"Added Conditional Column" = Table.AddColumn(#"Replaced Value", "Custom", each if [TransformedDate] = null then [Date] else [TransformedDate])
But use the GUI for adding a new Conditional Column, it's easier.
Hope that helps.
Hi ToddChitt
Thank you for your reply
However, I dont want to replace the TransformedDate.
But want to replace/copy values of the " TransformedDate " which are NOT NULL (meaning with date values only from TransforedDate) and replace it to the " Date " column
My last custom step --> = #"Sorted Rows"
How to resolve this. Send me the query code
- ToddChitt5 years agoSuper User
Have you looked at the Conditional Column options? You can still do this.
What is the Condition? (the "IF" part)? [TransformDate] IS NULL
What is the Output if the Condition is evaluated to TRUE? (The THEN part)?
What is the Output if the Condition is evaluated to FALSE (The ELSE part)?
One way or another, you are goig to need to 1) Create a new Conditional column, 2) remove one or both of the originating columns, and 3) re-name the new column so it takes the place of one of the original ones.
Try writing out your logic in your native language:
IF [Transform date] IS NULL, then I want [Date], otherwise I want [Transform Date]
Or is it something else?
- venstart5 years agoFrequent Visitor
Can I send you the power bi file so that you can check the 2 column in the table