This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
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
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 35 | |
| 33 | |
| 26 | |
| 22 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 36 | |
| 32 | |
| 26 | |
| 23 |