Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I found a function to replace text using a lookup table. It works great. But the syntax is unfamiliar to me and I can't find a reference for it. Here's what I have:
replacer = (x,y,z)=>LookupTable{[#"lookup value"=x]}?[replacement]? ??x
I have 3 questions about the above:
Solved! Go to Solution.
Hi @halifaxious,
There is a lot going on here
replacer = (x,y,z)=>LookupTable{[#"lookup value"=x]}?[replacement]? ??x
First this is a custom replacer function which takes 3 arguments:
x = original value
y = match condition (true or false)
z = replacement value
Next its applying (optional) key match lookup to identify a unique row in the table
LookupTable{ [#"lookup value"=x] }?
Followed by (optional) field access, to return a value from a field/ column
[replacement]?
And finally applying coalesce, to return the input value if a null is returned.
?? x
Ps. If this helps solve your query please mark this post as Solution, thanks!
Some links to resources on these topics:
Visual guide to key match lookup
Hi @halifaxious,
There is a lot going on here
replacer = (x,y,z)=>LookupTable{[#"lookup value"=x]}?[replacement]? ??x
First this is a custom replacer function which takes 3 arguments:
x = original value
y = match condition (true or false)
z = replacement value
Next its applying (optional) key match lookup to identify a unique row in the table
LookupTable{ [#"lookup value"=x] }?
Followed by (optional) field access, to return a value from a field/ column
[replacement]?
And finally applying coalesce, to return the input value if a null is returned.
?? x
Ps. If this helps solve your query please mark this post as Solution, thanks!
Some links to resources on these topics:
Visual guide to key match lookup
Thank you for a very illuminating answer! I wish I'd come here about 2 hours ago instead of fruitlessly googling.
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 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |