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

#### April 4th Copilot Studio Coffee Chat | Recording Now Available

Did you miss the Copilot Studio Coffee Chat on April 4th? This exciting and informative session with Dewain Robinson and Gary Pretty is now available to watch in our Community Galleries!   This AMA discussed how Copilot Studio is using the conversational AI-powered technology to aid and assist in the building of chatbots. Dewain is a Principal Program Manager with Copilot Studio. Gary is a Principal Program Manager with Copilot Studio and Conversational AI. Both of them had great insights to share with the community and answered some very interesting questions!     As part of our ongoing Coffee Chat AMA series, this engaging session gives the Community the unique opportunity to learn more about the latest Power Platform Copilot plans, where we’ll focus, and gain insight into upcoming features. We’re looking forward to hearing from the community at the next AMA, so hang on to your questions!   Watch the recording in the Gallery today: April 4th Copilot Studio Coffee Chat AMA