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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Anonymous
Not applicable

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

Anonymous
Not applicable

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".

Anonymous
Not applicable

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

Anonymous
Not applicable

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.

Anonymous
Not applicable

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.