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
bcbuckley13
Helper III
Helper III

How to add filter to "Switch"?

Hello and thanks in advance.

I'm a beginner user and need to add a filter to this slicer, specifically for this "Turkey Time" contest.

There's a game being played, Know our Product, that I need to filter out that was played between Nov 7-18.

This same game was played on earlier dates, so I don't want to remove it from other contests.

Can I add that here?

 

1Huddle.JPG

2 ACCEPTED SOLUTIONS

Hi @bcbuckley13 ,

If you want to include all of the other games within those dates, EXCEPT for the "Know our Product". 

Please have a try.

contest=switch(true(),table[played on]>=date(2022,11,7)&&table[played on]<=date(2022,11,18)&&table[game name]<>"Know Our Product","&_Turkey Time",blank()

Add the &&table[game name]<>"Know Our Product" after the <=date(2022,11,18).

 

If I have misunderstood your meaning, please provide more details with your desired output and pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @bcbuckley13 ,

Remove the comma.Pay attention to these small details.

vpollymsft_0-1668128844312.png

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
bcbuckley13
Helper III
Helper III

I actually want to do the opposite.  I want to include all of the other games within those dates, EXCEPT for the "Know our Product".

Hi @bcbuckley13 ,

If you want to include all of the other games within those dates, EXCEPT for the "Know our Product". 

Please have a try.

contest=switch(true(),table[played on]>=date(2022,11,7)&&table[played on]<=date(2022,11,18)&&table[game name]<>"Know Our Product","&_Turkey Time",blank()

Add the &&table[game name]<>"Know Our Product" after the <=date(2022,11,18).

 

If I have misunderstood your meaning, please provide more details with your desired output and pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I'm getting this error. I'll try and upload a pbix file.

 

1Huddle_contest.JPG

Hi @bcbuckley13 ,

Remove the comma.Pay attention to these small details.

vpollymsft_0-1668128844312.png

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much!!! This worked. So much to learn about PBI still.

 

Question....can I use Switch twice on the same table? I'm trying to duplicate this one, but then not include the game names.

v-rongtiep-msft
Community Support
Community Support

Hi @bcbuckley13 ,

If you only want to add the Know our Product between Nov 7-18., you can add it.

Please have a try.

contest=switch(true(),table[played on]>=date(2022,11,7)&&table[played on]<=date(2022,11,18)&&table[game name]="Know Our Product","&_Turkey Time",blank()

Add the &&table[game name]="Know Our Product" after the <=date(2022,11,18).

 

If I have misunderstood your meaning, please provide more details with your desired output and pbix file without privacy information.

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.