Forum Discussion
Nested Join with default key if null values
- 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.
One last question on the subject, what if I have 2 conditions with the same specificity?
For instance Color and Region?
Thanks in advacne for your help,
You just need to modify the Merged Queries step to base the nested join operation on Fruit and Region.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
- GaëlleFromGers3 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-jingzhang3 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