cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kervin
Resolver I
Resolver I

... If multiple ???

Bonjour,

Je viens (encore) avec une bête question

Je dois filtrer une galerie sur base base de la valeur d'une variable (Var1)

 

J'ai écris ceci :

if(var1="0";

    Filter(.....)  <=== Il m'indique une faute ici 
if(var1="1";

    Filter(.....);

If(var1="3";

    Filter(.....);

...

If(var1="5";

    Filter(.....)

 

Quelqu'un peut-il m'aider ? Merci pour votre aide

1 ACCEPTED SOLUTION

Accepted Solutions

bonjour v-xida-msft et mdevaney,

 

 

View solution in original post

4 REPLIES 4
mdevaney
Super User
Super User

@Kervin 
I suggest you use a SWITCH function instead.  If there is still an error please take a screenshot of the error message and post it to the forums.

 

Switch(var1;
    "0"; Filter(.....);
    "1"; Filter(.....);
    "3"; Filter(.....);
    "5"; Filter(.....)
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

v-xida-msft
Community Support
Community Support

Hi @Kervin ,

Could you please share more details about the error message within your Filter function?

 

Please consider take a try to modify your formula as below:

Filter(
       'Your Data Source';
       If(
          var1 = "0";
          FilteredColumn = var1;        // Type proper filter condition for var1="0" here
          var1 = "1";
          FilteredColumn2 = var1;       // Type proper filter condition for var1="1" here
          var1 = "3";
          FilteredColumn3 = var1;       // Type proper filter condition for var1="3" here
          ...
          ...
       )
)

 

In addition, I also agree with @mdevaney 's thought almost. You could achieve your needs using Switch function instead of If function:

Switch(
       var1;
       "0"; Filter(....);
       "1"; Filter(....);
       "3"; Filter(....);
       ...
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-xida-msft 

An honest question: if the idea I supplied is already good why bother to COPY + PASTE what I wrote into your own post? 🙄   Its simply enough to acknowledge my good work and carry on 😎

bonjour v-xida-msft et mdevaney,

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,537)