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
Dr0idy
Helper I
Helper I

Report Builder - Filter Chart to show only certain legend values depending on another property

I have a dataset in PowerBI I am creating a paginated report on via Report Builder. I want to filter the graph (which appears in a list) based on the Family Grouping in order to only show the relevant Local Authorities for the Family Grouping.

So far I have the following statement in the filter for the chart being evaluated as a boolean against true.

=Switch(Fields!Family_Grouping.Value="Environmental, Culture & Leisure, Economic Development, Corporate and Property",(Fields!Local_Authority.Value= "Stirling") OR (Fields!Local_Authority.Value= "Fife") OR (Fields!Local_Authority.Value= "Moray") OR (Fields!Local_Authority.Value= "North Ayrshire") OR (Fields!Local_Authority.Value= "East Lothian") OR (Fields!Local_Authority.Value= "East Ayrshire") OR (Fields!Local_Authority.Value= "Perth and Kinross") OR (Fields!Local_Authority.Value= "South Ayrshire") OR (Fields!Local_Authority.Value= "Scotland"),Fields!Family_Grouping.Value="Children, Social Work and Housing",(Fields!Local_Authority.Value= "Stirling") OR (Fields!Local_Authority.Value= "Scotland") OR (Fields!Local_Authority.Value= "Moray") OR (Fields!Local_Authority.Value= "East Lothian") OR (Fields!Local_Authority.Value= "Angus") OR (Fields!Local_Authority.Value= "Scottish Borders") OR (Fields!Local_Authority.Value= "Highland") OR (Fields!Local_Authority.Value= "Argyll & Bute") OR (Fields!Local_Authority.Value= "Midlothian"))

For some reason even if the family group is "Children, Social Work and Housing" the expression still returns the first set of Local Authorities.

Could use some help as not sure what I am doing wrong here (Can I not pass the OR statements with Switch?)

2 REPLIES 2
CheenuSing
Community Champion
Community Champion

Hi @Dr0idy 

 

Your requirement is not clear.

 

Do you mean that given the value of Fields!Family_Grouping.Value you want the value of (Fields!Local_Authority.Value

 

In a SWITCH statement you can not write OR expression as resulting value.

 

If based on one of the values mentioned in the  OR condition of   Fields!Local_Authority.Value , you want the result to be

  Fields!Family_Grouping.Value , then just reverse the SWITCH statement.

 

Share your pbix in google or one drive and paste the link here to understand better.

 

Cheers

 

ChennuSing 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

This is in Report Builder not the PowerBI Desktop client.

Sorry if I was unclear. In my dataset I have two columns one that tells me which Family Group the Indicator value belongs to and another that tells me which local authority it belongs to. I have a chart within a list tablix in the report builder and I want to show only specific local authorities in the chart depending on what the family group of the PI is. I had it working without the switch statement for one of the sets of OR statements as below.

Capture.PNG

Where the OR statement was

 

(Fields!Local_Authority.Value= "Stirling") OR
(Fields!Local_Authority.Value= "Fife") OR
(Fields!Local_Authority.Value= "Moray") OR
(Fields!Local_Authority.Value= "North Ayrshire") OR
(Fields!Local_Authority.Value= "East Lothian") OR
(Fields!Local_Authority.Value= "East Ayrshire") OR
(Fields!Local_Authority.Value= "Perth and Kinross") OR
(Fields!Local_Authority.Value= "South Ayrshire") OR
(Fields!Local_Authority.Value= "Scotland")

 

 

 

I am just unsure how to apply one set of OR tests for one family group and another for a second family group.

 

My data columns are

Indicator CodeYearLocal AuthorityValueFamily Group

 

Any help is greatly appreciated.

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