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

#### December 2023 User Group Update: Welcoming New Groups and Upcoming Events

A new month means it's time to celebrate and welcome the new user groups that have joined our community. We are excited to announce that we have more than 8 New Groups, which is no surprise after the amazing Microsoft Power Platform Conference. This month, we are breaking them out by the different community categories. If your group is listed here, give this post a kudo so we can celebrate with you! Don't forget to take a look at the many events happening near you or virtually! It's a great time of year to connect and engage with User Groups both locally and online.   Please Welcome Our NEW User Groups   Power Platform: PowerIT User Group: Nottingham Power Platform User Group: Bergen Power Platform User Group: Danmark Nashville Power Platform User Group Microsoft Ambassador Program y Mujer Latina Technolochicas NCWIT Community Copilot Studio:  Copilot User Group Italia Dynamics365: Dynamics User Group AdriaticDynamic 365 Azerbaijan   December User Group Events   01 Dec 2023 Aprendiendo Desarrollo web, creando mi primer power app y power page. 01 Dec 2023 Q4 Hybrid Philadelphia Dynamics 365 & Power Platform User Group Meeting05 Dec 2023APAC Dynamics 365 FastTrack Bootcamp - BI and Analytics07 Dec 2023Bay Area Power Platform Meetup: Learn, Share, and Connect07 Dec 2023Indiana D365/AX December User Group Meeting07 Dec 2023Dynamics User Group Meeting: Houston09 Dec 2023 December '23 - NEW Power Apps User Group Meeting - Online 12 Dec 2023December Cleveland Power Platform User Group Meeting12 Dec 2023 RW2 Data Stewardship Open Forum Discussion 13 Dec 2023  Black Country Power Platform User Group - December 2023 - West Midlands