Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
Hello,
I am trying to replace dates in column "BASELINE Start Date" with a date of 1 Jan 2000 based on if the value in column "RAG Number" = 4. See querry below. It is not working somehow...
Any help much appreciated!
= Table.ReplaceValue(#"Renamed Columns2",each[BASELINE Start Date], each if [RAG Number] = "4" then [BASELINE Start Date] = #date(2000, 1, 1) else [BASELINE Start Date], Replacer.ReplaceValue,{"BASELINE Start Date"})
Solved! Go to Solution.
Perhaps your [RAG Number] column is number type, not text type?
Try changing this:
each if [RAG Number] = "4" >> each if [RAG Number] = 4 // No quotes for number types
Pete
Proud to be a Datanaut!
Hi @Anonymous ,
Try removing the second explicit reference to your column like this. You've laready identified the column to affect in the second argument, so you shouldn't need to declare it again:
= Table.ReplaceValue(
#"Renamed Columns2",
each [BASELINE Start Date],
each if [RAG Number] = "4" then #date(2000, 1, 1) else [BASELINE Start Date],
Replacer.ReplaceValue,{"BASELINE Start Date"}
)
If that doesn't work, try changing the Replacer type:
Replacer.ReplaceValue >> Replacer.ReplaceText
Pete
Proud to be a Datanaut!
Thanks for the feedback. I have tried, but unfortunatly no luck.
Perhaps your [RAG Number] column is number type, not text type?
Try changing this:
each if [RAG Number] = "4" >> each if [RAG Number] = 4 // No quotes for number types
Pete
Proud to be a Datanaut!
Hi BA_Pete,
Great! This indeed solved the problem. Many thanks!
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.