Forum Discussion
Pass parameter from Cell(s)
Exact solution depends on the data type of your list and what syntax your need.
BUT,
Lets say you have a table called Parameters and the column with the parameter values is called Values
The expression Text.Combine(Parameters[Values],”, ")
Will give you a text string of all you parameter values separated by commas.
This works for number values. If you need quotes, you probably need to add a custom column in your Parameters table to include the quotes first.
Hmmm. Not totally sure I follow. Let's say my source table looks like this:
My query to selct a subset of CustomerIDs would look like this (source is a query loading data from SQL Server)
Now I create a new table in Excel called ParmTable. The user pastes the desired list of CustomerIDs into this table.
This table has been loaded to PQ and then I right clicked it and hit Drill Down
So now how would I modify my query to use the list of parameters from ParmTable instead of a hardcoded list?
- PwerQueryKees1 year agoSuper User
SqlQuery = "SELECT * FROM Sales where CustomerId in (" & Text.Combine(ParmTable, ",") & ")"