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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
ecoquelet
Frequent Visitor

Select all values parameter in Power Query

Hello !

 

I have some data that I need to be able to filter by country. So, I've created a parameter for it by getting a list of distinct values from the Country column, then I modified the query in editor by placing the parameter name in filtering step.

This works fine, however I'm wondering :

 

Are there any possibility to get an option of selecting all the values from the list of countries or desactivate the Parameter, so I can also keep all the data if needed ? 

 

Thank you in advance !

1 ACCEPTED SOLUTION
ChielFaber
Super User
Super User

I Think you can make this work. You can create something like this

 

First create a new parameter which only has the options true/false (TRUEFALSE_param)

false meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = type logical, List = {true, false}, DefaultValue = false]
 
As a second step you can create a blank query with an  if statement with the original paramater field (countries list)
 
if TRUEFALSE_param = true then Text.From(Countries_parameter) else "
[Columname] <> null and [Columname] <> "")
 
Then in the filter you could just use the Text.From function with this query as a source.
 
I used something similar in a native.sql query in Dataflows.
 
 

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Power BI:
Table.SelectRows(#"Change type", if ParmChooseCountry = null then each [Country]<>ParmChooseCountry else each [Country]=ParmChooseCountry)

ChielFaber
Super User
Super User

I Think you can make this work. You can create something like this

 

First create a new parameter which only has the options true/false (TRUEFALSE_param)

false meta [IsParameterQuery = true, IsParameterQueryRequired = true, Type = type logical, List = {true, false}, DefaultValue = false]
 
As a second step you can create a blank query with an  if statement with the original paramater field (countries list)
 
if TRUEFALSE_param = true then Text.From(Countries_parameter) else "
[Columname] <> null and [Columname] <> "")
 
Then in the filter you could just use the Text.From function with this query as a source.
 
I used something similar in a native.sql query in Dataflows.
 
 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors