Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi, I wonder if it is possible to simplyfy multiple calls to Table.ReplaceValue by creating one function?
Here are 3 calls to Table.ReplaceValue:
#"Encode Id" = Table.ReplaceValue(Source, each [Tenant Id], each fnc_ATS_Encode_Id([Tenant Id], pTR),Replacer.ReplaceValue,{"Tenant Id"}),
#"Encode Id2" = Table.ReplaceValue(#"Encode Id", each [Department Id], each fnc_ATS_Encode_Id([Department Id], pTR),Replacer.ReplaceValue,{"Department Id"}),
#"Encode Id3" = Table.ReplaceValue(#"Encode Id2", each [Parent Department Id], each fnc_ATS_Encode_Id([Parent Department Id], pTR),Replacer.ReplaceValue,{"Parent Department Id"}
It would be nice to have a function like below taking only the table and a list of the 3 column names as parameters:
#"Encode Id" = fnc_ATS_EncodeCols(Source, {{"Tenant Id"}, {"Department Id"}, {"Parent Department Id"}})
which then calls Table.Replace for each of the columns specified in the paramter list.
My attempt to use
col = Table.Column("Tenant Id") to get the col inside fnc_ATS_EncodeCols() to use as [col] did not succeed...
Eric
Solved! Go to Solution.
Hi @Eric7
You could just transform each column in one line, but I do find Table.ReplaceValue to work a bit faster.
Try this:
Hi @Eric7
You could just transform each column in one line, but I do find Table.ReplaceValue to work a bit faster.
Try this:
Thank you so much, my friend! Works perfectly.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
11 | |
8 | |
7 |