cancel
Showing results for
Did you mean:
Power Automate

## Nested If Help Needed

Does anyone see why this formula isn't working? (I have done something similar in XL a million times - but only 1 side of the equation is working. (Goal: If the slider value is more than 50, then set the visible property to true, and if slider value is less then 35, then set the visible property to true, in every other case, visible should be false.)

VISIBLE PROPERTY ON AN ICON

If(SliderWeight.Value > 50, true, If(SliderWeight.Value < 35, true, false))

Thank you.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Power Apps

Tried this exact formula and it worked: the icon is shown when the slider values are between 0 and 34, and between 51 and 100 (for the slider's default Min/Max values). What is not working for you?

On a related note: you can also rewrite that formula as follows, using the Or operator, and not the If function:

Icon1.Visible: SliderWeight.Value > 50 || SliderWeight.Value < 35

Community Champion

In addition to @CarlosFigueira's solution, I think it is useful to know that If no longer needs to be nested. You can just use commas to show what to check next. If the result you're looking for is boolean, you don't even need If. But anyway, below is an example of how you can chain If with only one If.

`If(SliderWeight.Value > 50, true, SliderWeight.Value < 35, true, false)`

This means, "If the value of SliderWeight is greater than 50, make the Visible property true. Otherwise, if it's less than 35, make it visible. Else hide it."

Microsoft Employee
@8bitclassroom
3 REPLIES 3
Power Apps

Tried this exact formula and it worked: the icon is shown when the slider values are between 0 and 34, and between 51 and 100 (for the slider's default Min/Max values). What is not working for you?

On a related note: you can also rewrite that formula as follows, using the Or operator, and not the If function:

Icon1.Visible: SliderWeight.Value > 50 || SliderWeight.Value < 35

Power Automate

Thank you. In my case it is acting very if-y (no pun intended). Sometimes it works, and sometimes when I change the slider it stops working on one end (either the low or the high).

Here's what I'm going to do: I'm going to add another set of controls with the OR statement (love it!), and then test both to see if I can tell which is best.

IMO I'm very worried about the performance (latency) inconsistencies I'm experiencing; so I'm carefully journalling the advantage of one expression over another for speed so thank you very much for presenting an option.

Thank you so very much!

Community Champion

In addition to @CarlosFigueira's solution, I think it is useful to know that If no longer needs to be nested. You can just use commas to show what to check next. If the result you're looking for is boolean, you don't even need If. But anyway, below is an example of how you can chain If with only one If.

`If(SliderWeight.Value > 50, true, SliderWeight.Value < 35, true, false)`

This means, "If the value of SliderWeight is greater than 50, make the Visible property true. Otherwise, if it's less than 35, make it visible. Else hide it."

Microsoft Employee
@8bitclassroom

Announcements

#### Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!