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 nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hello
I would like to optimize the code of power query when I do search / replace
In a date field I process 3 types of modifications in a row and I would like to make these 3 modifications on a single line of code
#"Filtered rows4" = Table.SelectRows(#"Replaced errors", each true),
#"Replaced Value3" = Table.ReplaceValue(#"Filtered Lines4",null, "12/31/2050",Replace.ReplaceValue,{"Theoretical Date Lease End"}),
#"ReplacedValue4" = Table.ReplaceValue(#"ReplacedValue3", "SO", "12/31/2050",Replacer.ReplaceText,{"Theoretical End of Lease Date"}),
#"Replaced Value5" = Table.ReplaceValue(#"Replaced Value4", "cf SM", "12/31/2050",Replacer.ReplaceText,{"Theoretical Date Lease End"}),
#"Replaced Value6" = Table.ReplaceValue(#"Replaced Value5", "cf CAS", "12/31/2050",Replacer.ReplaceText,{"Theoretical Date Lease End"}),
My proposal that doesn't work for the moment
= List.ReplaceValue(#"ReplacedValue3", "SO", "cf CAS", "cf SM", "31/12/2050",Replacer.ReplaceText,{"Theoretical End of Lease Date"})
Obviously it only takes my 3 fields to replace
Thanks for your help
#"Filtered rows4" = Table.SelectRows(#"Replaced errors", each true),
this line is nothing but gibberish.
#"Replaced Value3" = Table.ReplaceValue(#"Filtered Lines4",each [Theoretical Date Lease End], each if List.Contains({null, "cf CAS", "cf SM"}, [Theoretical Date Lease End]) then "12/31/2050" else [Theoretical Date Lease End], Replace.ReplaceValue, {"Theoretical Date Lease End"}),
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@Anonymous
You add the following step after #"Filtered rows4" step
Table.TransformColumns(#"Filtered Lines4", {{"Channel", each if List.Contains({"SO", "cf CAS", "cf SM"},_) then "12/31/2050" else _, type text}})
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 23 | |
| 21 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 58 | |
| 53 | |
| 42 | |
| 30 | |
| 24 |