{"id":41413,"date":"2025-06-06T14:57:46","date_gmt":"2025-06-06T09:27:46","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=41413"},"modified":"2025-06-06T14:57:46","modified_gmt":"2025-06-06T09:27:46","slug":"exploring-the-potential-of-power-fx-functions-preview-in-power-apps","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2025\/06\/exploring-the-potential-of-power-fx-functions-preview-in-power-apps\/","title":{"rendered":"Exploring the Potential of Power Fx Functions (Preview) in Power Apps"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41426\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/Exploring-the-Potential-of-Power-Fx-Functions-Preview-in-Power-Apps.png\" alt=\"Exploring the Potential of Power Fx Functions (Preview) in Power Apps\" width=\"1925\" height=\"1100\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/Exploring-the-Potential-of-Power-Fx-Functions-Preview-in-Power-Apps.png 1925w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/Exploring-the-Potential-of-Power-Fx-Functions-Preview-in-Power-Apps-300x171.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/Exploring-the-Potential-of-Power-Fx-Functions-Preview-in-Power-Apps-1024x585.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/Exploring-the-Potential-of-Power-Fx-Functions-Preview-in-Power-Apps-768x439.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/Exploring-the-Potential-of-Power-Fx-Functions-Preview-in-Power-Apps-1536x878.png 1536w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/Exploring-the-Potential-of-Power-Fx-Functions-Preview-in-Power-Apps-660x377.png 660w\" sizes=\"(max-width: 1925px) 100vw, 1925px\" \/><\/p>\n<p>As developers, we often encounter scenarios where the same logic needs to be written in multiple places. This may result in code redundancy and possible discrepancies. To address this, Microsoft has introduced Power Fx Functions (Preview) \u2014 enabling a low-code approach to creating reusable logic within Power Apps.<\/p>\n<p>With Power Fx Functions, you can define custom business logic once and use it across Canvas Apps, Power Automate Flows, and Dataverse\u2014all while maintaining consistency and efficiency.<\/p>\n<h2><strong>What Are Power Fx Functions?<\/strong><\/h2>\n<p>Power Fx Functions are reusable formulas that accept input parameters and return calculated output. Once published in Dataverse, these functions can be called just like built-in Power Fx functions, but with your custom logic.<\/p>\n<p><strong>Benefits:<\/strong><\/p>\n<ul>\n<li><strong>Reusability:<\/strong> Write once, use anywhere.<\/li>\n<li><strong>Maintainability:<\/strong> Update logic centrally.<\/li>\n<li><strong>Consistency:<\/strong> Avoid mismatched business logic.<\/li>\n<li><strong>Modularity:<\/strong> Break complex logic into manageable pieces.<\/li>\n<\/ul>\n<p><strong>Use Case: Tiered Discounts for a Grocery Shop<\/strong><\/p>\n<p>Let\u2019s consider a grocery store that offers tiered discounts based on the total invoice:<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>Total Invoice <\/strong><\/td>\n<td><strong>Discount<\/strong><\/td>\n<\/tr>\n<tr>\n<td>3,000 \u2013 5000<\/td>\n<td>\u00a0\u00a0 10%<\/td>\n<\/tr>\n<tr>\n<td>5,000 \u2013 10000<\/td>\n<td>\u00a0\u00a0 20%<\/td>\n<\/tr>\n<tr>\n<td>10,000 and above<\/td>\n<td>\u00a0\u00a0 30%<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let\u2019s implement this logic using a custom Power Fx Function in Dataverse.<\/p>\n<p><strong>Step 1: <\/strong><strong>Navigate to Power Fx Functions<\/strong><\/p>\n<ul>\n<li>Go to <a href=\"https:\/\/make.powerapps.com\/\" target=\"_blank\" rel=\"noopener\">PowerApps<\/a>.<\/li>\n<li>In your selected environment, open the left menu and select \u201cDiscover,\u201d then click on \u201cFunctions (Preview)<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41414\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/1Power-Fx-Functions-in-Power-Apps.png\" alt=\"Power Fx Functions in Power Apps\" width=\"1915\" height=\"890\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/1Power-Fx-Functions-in-Power-Apps.png 1915w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/1Power-Fx-Functions-in-Power-Apps-300x139.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/1Power-Fx-Functions-in-Power-Apps-1024x476.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/1Power-Fx-Functions-in-Power-Apps-768x357.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/1Power-Fx-Functions-in-Power-Apps-1536x714.png 1536w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/1Power-Fx-Functions-in-Power-Apps-660x307.png 660w\" sizes=\"(max-width: 1915px) 100vw, 1915px\" \/><\/p>\n<p><strong>Step 2: <\/strong><strong>Create New Function<\/strong><\/p>\n<p>Click on Functions, then hit + New function.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41415\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/2Power-Fx-Functions-Preview-in-Power-Apps.png\" alt=\"Power Fx Functions in Power Apps\" width=\"1380\" height=\"642\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/2Power-Fx-Functions-Preview-in-Power-Apps.png 1380w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/2Power-Fx-Functions-Preview-in-Power-Apps-300x140.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/2Power-Fx-Functions-Preview-in-Power-Apps-1024x476.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/2Power-Fx-Functions-Preview-in-Power-Apps-768x357.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/2Power-Fx-Functions-Preview-in-Power-Apps-660x307.png 660w\" sizes=\"(max-width: 1380px) 100vw, 1380px\" \/><\/p>\n<p>Provide the following details:<\/p>\n<ul>\n<li><strong>Display Name:<\/strong> Give the relevant name as per functionality.<\/li>\n<\/ul>\n<p>CalculateGroceryDiscount<\/p>\n<ul>\n<li><strong>Description: <\/strong>Explain what actually function does.<\/li>\n<\/ul>\n<p>Applies discount based on total invoice<\/p>\n<ul>\n<li><strong>Input Parameter: <\/strong>The data the function needs to work with.\n<ul>\n<li>invoiceTotal (Float)<\/li>\n<\/ul>\n<\/li>\n<li><strong>Return Fields: <\/strong>The result the function returns.\n<ul>\n<li>DiscountApplied (Float)<\/li>\n<li>FinalAmount (Float)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41416\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/3Power-Fx-Functions-Preview-in-Power-Apps.png\" alt=\"Power Fx Functions in Power Apps\" width=\"659\" height=\"839\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/3Power-Fx-Functions-Preview-in-Power-Apps.png 659w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/3Power-Fx-Functions-Preview-in-Power-Apps-236x300.png 236w\" sizes=\"(max-width: 659px) 100vw, 659px\" \/><\/p>\n<pre class=\"lang:css gutter:true start:1\">Formula :\r\nWith(\r\n\r\n{\r\n\r\n\u00a0\r\n\r\ndiscount:\r\n\r\nIf(\r\n\r\ninvoiceTotal &gt;= 3000 &amp;&amp; invoiceTotal &lt;= 5000, 0.1,\r\n\r\ninvoiceTotal &gt; 5000 &amp;&amp; invoiceTotal &lt;= 10000, 0.2,\r\n\r\ninvoiceTotal &gt; 10000, 0.3,\r\n\r\n0\r\n\r\n)\r\n\r\n},\r\n\r\n{\r\n\r\nDiscountApplied: discount,\r\n\r\nFinalAmount: invoiceTotal * (1 - discount)\r\n\r\n}\r\n\r\n)<\/pre>\n<p>Once defined, Click Save Then click Publish.<\/p>\n<p><strong>Step 3: Test the Power Fx Function<\/strong><\/p>\n<p>Click the ellipsis (\u2026) next to the function.<\/p>\n<p>Click Test.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41417\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/4Power-Fx-Functions-Preview-in-Power-Apps.png\" alt=\"Power Fx Functions (Preview) in Power Apps\" width=\"1378\" height=\"588\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/4Power-Fx-Functions-Preview-in-Power-Apps.png 1378w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/4Power-Fx-Functions-Preview-in-Power-Apps-300x128.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/4Power-Fx-Functions-Preview-in-Power-Apps-1024x437.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/4Power-Fx-Functions-Preview-in-Power-Apps-768x328.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/4Power-Fx-Functions-Preview-in-Power-Apps-660x282.png 660w\" sizes=\"(max-width: 1378px) 100vw, 1378px\" \/><\/p>\n<p>Enter a test value for invoiceTotal and click Play<\/p>\n<p>You will see the discount applied and final amount returned.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41418\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/5Power-Fx-Functions-Preview-in-Power-Apps.png\" alt=\"Power Fx Functions (Preview) in Power Apps\" width=\"1381\" height=\"615\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/5Power-Fx-Functions-Preview-in-Power-Apps.png 1381w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/5Power-Fx-Functions-Preview-in-Power-Apps-300x134.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/5Power-Fx-Functions-Preview-in-Power-Apps-1024x456.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/5Power-Fx-Functions-Preview-in-Power-Apps-768x342.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/5Power-Fx-Functions-Preview-in-Power-Apps-660x294.png 660w\" sizes=\"(max-width: 1381px) 100vw, 1381px\" \/><\/p>\n<p><strong>Step 4: Integrate above Power Fx Function in Canvas App<\/strong><\/p>\n<p>We\u2019ll now use this function in a simple app named GroceryDiscountApp.<\/p>\n<p>1. Add a Button to Create Sample Cart.<\/p>\n<p>Set its <strong>OnSelect<\/strong> property to:<\/p>\n<pre class=\"lang:css gutter:true start:1\"><em>ClearCollect(<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0 colCart,<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0 { Item: \"Item1\", Quantity: 2, Price: 1000 },<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0 { Item: \"Item2\", Quantity: 1, Price: 400 },<\/em>\r\n\r\n<em>\u00a0\u00a0\u00a0 { Item: \"Item3\", Quantity: 3, Price: 100 }<\/em><\/pre>\n<p>2. Add a Gallery to Display Cart Items.<\/p>\n<p>Set its Items property to:<\/p>\n<p><em>\u00a0colCart<\/em><\/p>\n<p>Inside the gallery, add labels to show:<\/p>\n<ul>\n<li><em>Item<\/em><\/li>\n<li><em>Quantity<\/em><\/li>\n<li><em>Price<\/em><\/li>\n<li><em>Quantity * ThisItem.Price<\/em><\/li>\n<\/ul>\n<p>3. Add a Button to Calculate Discount.<\/p>\n<pre class=\"lang:css gutter:true start:1\">Set its OnSelect property to:\r\n\r\n<em>Set(invoiceTotal, Sum(colCart, Quantity * Price));<\/em>\r\n\r\n<em>Set(discountResult, Environment.cr860_CalculateGroceryDiscount({ invoiceTotal: invoiceTotal }))<\/em><\/pre>\n<p>4. Add two labels:<\/p>\n<pre class=\"lang:css gutter:true start:1\">Label 1 (Discount): <em>\"Discount: \" &amp; Text(discountResult.DiscountApplied * 100) &amp; \"%\"<\/em>\r\nLabel 2 (Final Amount): <em>\"Final Amount: \u20b9\" &amp; Text(discountResult.FinalAmount)<\/em><\/pre>\n<p>Click &gt; Preview the app &gt; generate the cart, run the function, and display the results!<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-41419\" style=\"border: 1px solid #000000; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/6Power-Fx-Functions-Preview-in-Power-Apps.png\" alt=\"Power Fx Functions (Preview) in Power Apps\" width=\"1378\" height=\"609\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/6Power-Fx-Functions-Preview-in-Power-Apps.png 1378w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/6Power-Fx-Functions-Preview-in-Power-Apps-300x133.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/6Power-Fx-Functions-Preview-in-Power-Apps-1024x453.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/6Power-Fx-Functions-Preview-in-Power-Apps-768x339.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/06\/6Power-Fx-Functions-Preview-in-Power-Apps-660x292.png 660w\" sizes=\"(max-width: 1378px) 100vw, 1378px\" \/><\/p>\n<p>This enables you to include the function in your Power Apps formulas, treating it like other standard Power Fx functions.<\/p>\n<p><strong><em>Note : Currently, The Power Fx Function is in Preview State.<\/em><\/strong><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>The ability to create custom, reusable Power Fx functions is a significant step forward for Power Apps. It empowers developers to build more robust, efficient, and maintainable applications. As Power Fx continues to evolve, we can expect even more powerful features that further bridge the gap between low-code and pro-code development.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As developers, we often encounter scenarios where the same logic needs to be written in multiple places. This may result in code redundancy and possible discrepancies. To address this, Microsoft has introduced Power Fx Functions (Preview) \u2014 enabling a low-code approach to creating reusable logic within Power Apps. With Power Fx Functions, you can define\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2025\/06\/exploring-the-potential-of-power-fx-functions-preview-in-power-apps\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2763,2355,2361],"tags":[2743,2356],"class_list":["post-41413","post","type-post","status-publish","format-standard","hentry","category-power-pages","category-powerfx","category-technical","tag-power-pages","tag-powerfx"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/41413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=41413"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/41413\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=41413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=41413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=41413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}