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
Syndicate_Admin
Administrator
Administrator

Code for items in gallery to filter using dropdown

I'm trying to filter a gallery by saying that when the dropdown can be edited and an option is selected, it would filter according to that in a particular category, otherwise it would just filter by category. My code for items is,

If(ddStatus.DisplayMode.Edit, Filter('List', Category.Value = "1" && 'Status'.Value = ddStatus.Selected.Value), Filter('List', Category.Value = "1"))

But with this code, it just filters by category and not by status when an option from the dropdown is selected. Is there some error here?

1 REPLY 1
v-cgao-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

Please try:

If(!IsBlank(ddStatus.Selected.Value), Filter('List', Category.Value = "1" && 'Status'.Value = ddStatus.Selected.Value), Filter('List', Category.Value = "1"))

This code checks if a value is selected in the dropdown (), and if so, filters the list by both category and status. Otherwise, it filters the list by category only.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

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