Force User to Select Slicer/Parameter Before Executing SQL

Viewed 28

My Power Query expression is mostly a SQL query, taking advantage of query folding with a Snowflake SQL database. My where clause references two parameters that an end user sets in slicers:

WHERE Time BETWEEN '" & Date.ToText(DateTime.Date(StartTimeParameter)) & "' AND '" & Date.ToText(DateTime.Date(EndTimeParameter)) & "'

How can I require that the user selects the slicer/parameter value before the SQL is executed? Currently the SQL executes when the report is opened, and again when the parameter is changed. Perhaps I can make better default values, but most users will still need to adjust the slicers/parameters. The full SQL is complex and has a noticeable load time. I have tried making the two parameters optional, but the Power Query expression becomes invalid:

Expression.Error: We cannot convert the value null to type Text.

0 Answers
Related