Quick Guide to Formula FX in Model-Driven Apps

Power FX Formulas Learning

Power FX Formulas in Model Driven App

Let’s learn about the Power FX Formulas in Model Driven App. If you are looking to learn this quickly, no worries! Let me guide you through a small learning example that will mostly cover a range of functions commonly used.



Mathematical Functions

  • Sum of two fields
Copied!
NumberField1 + NumberField2
  • Multiplication
Copied!
NumberField1 * NumberField2
  • Round
Copied!
Round(NumberField1 / NumberField2, 2)


Logical Functions

  • If statement for Discount
Copied!
If(NumberField1 > 1000, "Eligible for Discount", "Not Eligible for Discount")
  • Switch
Copied!

Switch(NumberField1, 
    1, "One", 
    2, "Two", 
    3, "Three", 
    "Other")


Text Functions

  • Concatenate
Copied!
Concatenate(TextField1, " ", TextField2)
  • Calculate Text (Substring Extraction)
Copied!
Mid(TextField1, 2, 3)


Date and Time Functions

  • Calculate Number (DateDiff)
Copied!
DateDiff(DateField1, DateField2)


Notes by Akira28

  • Data Type Restrictions: Limited to text, number, date, and lookup fields. No support for complex fields.
  • No Workflow Triggers: Power Fx columns can’t initiate workflows or external actions.
  • Read-Only: Formula columns are read-only; they can’t modify or write data back.
  • Limited Complex Logic: Can slow down performance if complex logic is used.
  • No Direct Table Operations: Cannot create, delete, or modify other records.
  • Execution Scope: Formula calculations are limited to the current record.
  • No UI Interactions: Cannot trigger formula execution based on user actions.
  • Limited Function Set: Certain Power Fx functions are not available in Dataverse.
Form Example
‘Number Field 1’ * ‘Number Field 2’
Round(‘Number Field 1’ / ‘Number Field 2’, 2)
If(Mod(‘Number Field 1’, ‘Number Field 2’) = 0, 1, 0)
‘Number Field 1’ + ‘Number Field 2’
DateDiff(‘Date Field 1’, ‘Date Field 2’, TimeUnit.Days)
Concatenate(‘Text Field 1’, ” “, ‘Text Field 2’)
If(‘Number Field 1’ > 1000, “Eligible for Discount”, “Not Eligible for Discount”)
Mid(‘Calculated Text’, 1, 2)
Year(‘Date Field 1’)
Switch(‘Number Field 2’, 1, “One”, 2, “Two”, 3, “Three”, “Other”)
If(‘Calculate IfError’ = 01, “NumberField1 is divisible by NumberField2”, “NumberField1 is not divisible by NumberField2”)
DateAdd(‘Date Field 1’, 30)
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments