Home > Software engineering >  Can I implement a step in PowerQuery based on a condition?
Can I implement a step in PowerQuery based on a condition?

Time:10-18

I wanted to know if it is possible to let a step in the PowerQuery Editor be conducted based on a condition?

Basically, what I'm doing is that I am merging three specific tables in PowerQuery. Now, in Excel I have an additional field to check whether an optional fourth table should also be merged or not. Therefore, in PowerQuery I would need the condition to only do the merging of the fourth table in case the field in Excel was checked. Is something like this possible?

Thanks in advance!

CodePudding user response:

You would have to manually edit it in the advanced editor:

#"Previous Steps"
#"Merged Queries" = if <condition> then Table.NestedJoin(#"Previous Steps", ...) else #"Previous Steps"),
  • Related