Forum Discussion
How to pass multiple selected values from a slicer to Power Query via parameter?
You're welcome! It's hard to say the reason without seeing the revised script. I don't think it would be related to query folding = false though. Can you please send your revised script?
Hi jennratten
Please find below my updated script:
let
EntityList =
if
//check to see if the parameter is a list
Type.Is(
Value.Type(paraEntity),
List.Type
) then
//if it is a list
let
//add single quotes around each value in the list
AddSingleQuotes = List.Transform(
paraEntity,
each "'" & _ & "'"
),
//then turn it into a comma-delimited list
DelimitedList = Text.Combine(
AddSingleQuotes,
","
)
in
DelimitedList
else
//if the parameter isn't a list
//just add single quotes around the parameter value
"'" & paraEntity & "'",
//generate and run the query
Source = Value.NativeQuery(Snowflake.Databases("servername.com","warehouse_name",[Role="role_name"])
{[Name="database_name"]}[Data], "CALL DBO.SP_Calc('ABCXYZ', ['"& EntityList &"'], ['All'], ['All'], 'LC', ['22-Jan'], ['All'], ['Actual'], ['All'], ['All'])", null, [EnableFolding=false])
in
Source
Just to add some context - paraEntity is just one of the parameters I am using to take create a slicer out of a table. There are more user-selectable dropdowns bound to other parameters I have created that get passed to the stored proc (but I am hardcoding their value as 'All' for the moment).