Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
FrankKrogh
Helper I
Helper I

How to script a parameter query to return "SelectAll" when slicer "Select All" is unselected?

By default a slicer having the "Select All" (and all other values) unselected act in same way on a table visual object as when "Select All" is selected.

I have used the Dynamic M query parameters example (https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters) and wonder how to modify the Dynamic Query script to act in the same way on a slicer with "Select All" (and all other values) unselected?

My script returns no rows from the Dynamic Query in the table visual when slicer has "Select All" (and all other values) unselected. How can I modify the script to interpret this slicer state as a "return all rows" situation instead of "return no rows"? Parameter Query.JPG

 

 

1 ACCEPTED SOLUTION

Thanks for the response! But I am not sure I understand your suggestion. 

Should the SelectAllProducts Else-condition <else false> be replaced with <else ColorParameter = "__SelectAll__"> ?

 

The modification does not seem to make any different outcome. The slicer with all values unselected does still produce a query that returns an empty table visual.

 

After some testing I used this coding method to check if the slicer is unselected (the blankProdType expression). I also test the AllProductsSelected expression (valgtAlleProdTyper) and finally test the combination of selections (Text.Combine) to formulate the dynamic WHERE-condition. It works fine but it is maybe not the best way to solve the issue.

FrankKrogh_0-1679652414062.png

 

View solution in original post

2 REPLIES 2
artemus
Employee
Employee

My guess is that __SelectAll__ is getting passed as a single item instead of a list. Try changing line 10 to ColorParameter = "__SelectAll__"

 

PS: You should redact your SQL server name.

Thanks for the response! But I am not sure I understand your suggestion. 

Should the SelectAllProducts Else-condition <else false> be replaced with <else ColorParameter = "__SelectAll__"> ?

 

The modification does not seem to make any different outcome. The slicer with all values unselected does still produce a query that returns an empty table visual.

 

After some testing I used this coding method to check if the slicer is unselected (the blankProdType expression). I also test the AllProductsSelected expression (valgtAlleProdTyper) and finally test the combination of selections (Text.Combine) to formulate the dynamic WHERE-condition. It works fine but it is maybe not the best way to solve the issue.

FrankKrogh_0-1679652414062.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors