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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors