0
votes

I have created 4 separate tables via sql code on sqlserver and I want to create one filter for all 4 using a common column i.e. month on power query. Usually, I would create 4 pivot tables and create 4 slicers for say, month. Can I dynamically create just one filter for the 4 pivots on PQ? I have seen examples of anti-joins but I don't see this working in my example. If any questions like this already exist, links to them will be much appreciated.

Cheers,

Mo

1

1 Answers

0
votes

Table.SelectRows can takes a function as its second parameter, so you can create your filter function in one query and reference that query in the parameter.

For example, if I wanted to filter a column Value to only have numbers greater than 30, you would create a query with the following formula:

= (row) => row[Value] > 30

Let's call that query FilterValue. Then, if you wanted to use this filter on a table in step Step, you would add the following step (with the fx button next to the formula bar):

= Table.SelectRows(Step, FilterValue)

If you need to use the filter again in another query with the step OtherStep, add the following step:

= Table.SelectRows(OtherStep, FilterValue)