Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a scenario where I am needing to essentially create dynamic query steps based on a source table. In effect, this is "build-a-bear" but for Power Query.
For example, let's say my query initially just loads data from a DB:
I want to then allow an end user to add an item to a table that indicates we need to filter a column. Imagine something like this:
User | Action | Column | Value |
Joe Schmoe | Filter | Customer | Tailspin Toys (Head Office) |
I want my query to then "add" a query step that applies a filter:
Is something like this possible perhaps with functions or recursive function execution or something? Kind of like building a dynamic SQL query.
Sounds like you need to use parameters.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks for the reply, @mahoneypat! I'm sure parameters will play a part, but the issue is the number of filters to be applied could change as could the type of steps needed.
In the example above, a user may want to filter data to a specific customer when viewing a report one week but next week add filters that filter customer, product, and region. I need to not have to manually add filter logic that looks at all of those columns. He or she could even want to group by, say, product category, which isn't in the original query and is where (I'm hoping) the recursive behavior or custom function comes in.
Have you considered just loading all the data and then having all potential fitlers as slicers (or Filter panel options)?
You could also consider using paginated reports with parameters too.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks for the response! This isn't a visualization-first report but actually needs to be fully dynamic on the query/ETL side as this could extend to complex scenarios like user-defined merges between tables and duplicate removals. My hope is to create a dataflow that will let users alter the data loaded into a table dynamically using an app as a kind of business logic/rules engine.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.