Forum Discussion
GaëlleFromGers
3 years agoRegular Visitor
Nested Join with default key if null values
Hi all, I have a referential that I would like to merge in a table table using multiple columns. In order to avoid to duplicated lines in my referential, I would like my nested join to take into...
- 3 years ago
When merging queries, only base it on Fruit column.
Then add a custom column with below code to get the prices.
= let pColor = [Color] in Table.First(Table.Sort(Table.SelectRows([Referential], each [Color] = pColor or [Color] = ""), {"Color", Order.Descending}))[Price]Remove column "Referential".
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
GaëlleFromGers
3 years agoRegular Visitor
Actually, Region shoudl work like tyhe color: given region ou default value if not mentionned in the referential.
I thought it would be another parameter in the custom step?
v-jingzhang
3 years agoCommunity Support
I'm sorry. You're correct. You can modify the custom column step similar to below one:
= let pColor = [Color], pRegion = [Region] in Table.First(Table.Sort(Table.SelectRows([Referential], each ([Color] = pColor or [Color] = "") and ([Region] = pRegion or [Region] = "")), {{"Color", Order.Descending}, {"Region", Order.Descending}}))[Price]
BR,
Jing