r/ExcelPowerQuery • • Sep 16 '24

Convert a query into a "dynamic" parameter

I'm in great need of assistance because I can't figure this out with my googling skills and ChatGPT.

I want to use parameters to filter multiple queries and I want to do so without the user having to go in the PowerQuery Editor. Here's my idea so far :

  • Create an excel sheet named "Parameters" where the user can select the parameters from a restricted drop-down list.
  • Import this sheet in PowerQuery, keep only the data that will be used as a parameter which is only one cell.
  • Convert the previously created query from a table to a parameter and use said parameter to filter all of the other queries it's used into.

Problem is I can't figure out how to convert my quey into a parameter that will refresh its value according to user input when you refresh the workbook.

I figured how to do it with a VBA macro that modifies the value of the parameter I want to modify and then refreshes the workbook but it's too heavy for my liking. Is there a way to convert a table into a single point of data that is a parameter and that when the excel workbook is refreshed will filter my queries accordingly ?

3 Upvotes

6 comments sorted by

View all comments

Show parent comment

3

u/declutterdata Sep 16 '24

Hi DM,

a one cell table is pretty much the same.

Does WSPARAM have the correct format? If WSPARAM would be a number and your col is a as text formatted number, then WSPARAM would have to be written like "1234" instead of 1234.

Formula itself does not look wrong. Did you try to write the value of WSPARAM into the filter first, to see if it works without it?

I don't get your Expression.Error (can't find value?) without seeing it. Screenshot maybe?

Regards, Phillip from DeclutterData 🙋🏻‍♂️