Power Apps: With() & If() Tips
Power Apps
Oct 24, 2025 9:23 PM

Power Apps: With() & If() Tips

by HubSite 365 about Warner Digital

Master With and If in Power Apps to build dynamic lowcode galleries and cleaner YAML with Power Platform expertise

Key insights

  • With() - Defines local variables inside a single formula so you can compute values once and reuse them.
    Using With() reduces repetition and keeps formulas cleaner and easier to edit.
  • If() - Performs conditional checks and returns different results based on true/false conditions.
    Combine If() with With() to make UI and data logic more dynamic and readable.
  • Power Fx - The Excel-like formula language that drives canvas apps and controls app behavior.
    Power Fx works well with scoped variables and conditional logic to build maintainable low-code solutions.
  • Canvas apps - Drag-and-drop apps where using With() plus If() improves control behavior and data-driven layouts.
    This pattern keeps screen formulas compact and easier to troubleshoot.
  • Copilot and AI - Built-in AI tools now suggest and generate formulas, including when to use With() and If().
    AI speeds prototyping and helps optimize formulas for clarity and performance.
  • Performance & Maintainability - Scoping values with With() and minimizing repeated calculations improves app speed and reduces bugs.
    Follow this pattern to keep YAML snippets and app logic clean and easy to maintain.

Overview of the Video

The YouTube video from Warner Digital explains how to combine the With() and If() functions inside Power Apps to make galleries and controls more dynamic and easier to maintain. In clear, practical steps, the presenter demonstrates how this pattern reduces repetition and keeps YAML snippets clean. Moreover, the video emphasizes real-world scenarios where scoped variables can simplify conditional logic and speed up building low-code solutions. Consequently, the lesson targets makers who want both clarity and efficiency in app formulas.

In addition, the video provides a short agenda and timestamps to guide viewers through the content, from an introduction to the final wrap-up. It frames the technique as a best-practice rather than a new product, so viewers can apply it across canvas and model-driven apps. The material is rooted in the Power Fx formula language, and it shows how simple patterns can scale into larger, more maintainable apps. Therefore, the presentation fits both beginners and experienced makers looking to refine their approach.

Techniques Demonstrated

The core technique shown involves defining a local record with With() and then using If() conditions inside that scope to decide what to show or calculate. For example, the video shows a formula like With( { currentUser: User().FullName }, If( currentUser = "Admin", "Welcome, Administrator!", "Hello, " & currentUser ) ) to illustrate variable scoping and conditional output. This approach removes duplicate calls and clarifies intent, because the variable is defined once and reused. As a result, formulas look cleaner and are easier to audit.

Furthermore, the presenter explains how this pattern applies to galleries, where multiple items may require per-item logic without creating extra controls. Instead of scattering repeated logic, makers can compute values inside a single formula and bind the result to labels or properties. Consequently, you reduce rendering overhead and the chance of inconsistent logic across controls. This technique also helps keep YAML snippets compact and readable when exporting or sharing components.

Demo Highlights and Examples

The hands-on demo is a notable part of the video, where the author walks through implementing With() + If() inside a gallery and in card-like controls. The video shows step-by-step changes so viewers can follow along and reproduce the results in their apps. Along the way, the presenter points out small improvements that collectively make maintenance easier and performance better. Thus, viewers can immediately try the changes and see practical gains.

Moreover, the demo includes a wrap-up that summarizes the key code snippets and the reasoning behind them, reinforcing best practices. The examples are deliberately simple, but they scale conceptually to more complex logic and larger datasets. For makers working with nested conditions or repeated evaluations, the pattern reduces repetition and potential errors. Therefore, the demo serves both as a tutorial and as a template for future adaptations.

Benefits and Tradeoffs

Using With() and If() together improves readability and can boost performance, especially when you avoid redundant calculations in repeated controls. At the same time, the local scoping of With() means those variables are not available elsewhere, which is good for encapsulation but can limit reuse across multiple formulas. Consequently, teams must balance local clarity with the need for shared logic, deciding whether to use scoped variables or central utility functions.

Additionally, the video highlights how AI tools like Copilot can recommend these patterns, speeding development for many makers. However, reliance on AI suggestions introduces a tradeoff: automated recommendations may lack context or produce formulas that require human review. Thus, teams should treat AI help as a starting point while applying their own testing and governance. In short, the approach encourages rapid development but still requires thoughtful oversight to ensure correctness.

Challenges and Best Practices

Although the With() + If() pattern simplifies formulas, it can become hard to debug if you nest many levels or create complex conditional branches. Therefore, the presenter recommends clear variable names and breaking long formulas into smaller, testable parts. Additionally, consistent naming and short comments within the app editor help future maintainers understand intent. With that in mind, small design choices have a large impact on team productivity.

Performance on large datasets is another concern discussed indirectly in the video; minimizing server round-trips and redundant computations remains essential. As a practical step, the author suggests evaluating whether calculations belong in the app layer or should be precomputed in the data source. Consequently, makers should weigh tradeoffs between client-side flexibility and server-side efficiency, choosing the approach that fits scale and governance needs.

Conclusion

Overall, Warner Digital’s video provides a concise, actionable guide to combining With() and If() in Power Apps to create cleaner and more efficient formulas. The presentation balances examples, demos, and practical advice, helping makers adopt the pattern while warning about potential pitfalls. In short, the technique is a useful addition to any maker’s toolkit, provided teams pair it with clear naming, testing, and governance.

Finally, the video’s examples and explanations make it straightforward to start using the pattern and to adapt it for larger projects. As a result, both new and experienced builders can benefit by reducing repetition and improving maintainability, while remaining mindful of debugging and performance tradeoffs. Consequently, this approach strengthens low-code practices and supports sustainable app development.

Power Apps - Power Apps: With() & If() Tips

Keywords

Power Apps With() tutorial, Power Apps If() examples, Power Apps advanced formulas, Power Apps performance tips With If, Power Apps conditional logic guide, Power Apps formula best practices, Using With and If in Power Apps, Power Apps optimization patterns