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
galdezanni
New Member

Report in PowerBI Report Builder with multiple filters, allowing null values

Hi all,

 

I'm creating a report in PowerBI Report Builder with multiple filter options, but I'm not getting it to run as I imagined.

 

In the case, there are two filters, I would like to be able to filter by a "Função", or another "idDemanda", or using both, however if I select only one parameter it displays the following message: "insert a value for the parameter ' Function '. The parameter cannot be empty. "


How could I solve this problem?

 

Thank you!

1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

So you either need to change your parameter to all null or to have some sort of default value (like "All" or an empty string). But then you probably also need to edit your query to return the appropriate results when the parameter is null or has a default value.

So if you had a default value of "-ALL-" then the following code would show all colors if that was the value of the parameter otherwise it would filter for the color specified in the parameter.

EVALUATE
SUMMARIZECOLUMNS(
Product[Category],

FILTER( VALUES( Product[Color] ) , Product[Color] = @color || @color = "-ALL-" )

,"Sales Amount", [Sales Amount]
)

 

Or if you need more complex logic you can write your query as an expression and include IIF() functions to alter the query dynamically to make it more efficient.

View solution in original post

3 REPLIES 3
d_gosbell
Super User
Super User

So you either need to change your parameter to all null or to have some sort of default value (like "All" or an empty string). But then you probably also need to edit your query to return the appropriate results when the parameter is null or has a default value.

So if you had a default value of "-ALL-" then the following code would show all colors if that was the value of the parameter otherwise it would filter for the color specified in the parameter.

EVALUATE
SUMMARIZECOLUMNS(
Product[Category],

FILTER( VALUES( Product[Color] ) , Product[Color] = @color || @color = "-ALL-" )

,"Sales Amount", [Sales Amount]
)

 

Or if you need more complex logic you can write your query as an expression and include IIF() functions to alter the query dynamically to make it more efficient.

Petebro
Employee
Employee

Is this showing up in Power BI Desktop? Seems like a Power BI desktop specific question though I might be misunderstanding the question.

 

If you post this in the desktop subsection I think you can find an answer quicker.

I'm using PowerBI Report Builder, thanks for the answer

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.