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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors