In this article, we will explore how Power Fx simplifies Dataverse customization using a practical example: calculating a person’s age from their Date of Birth (DOB).
What is Power Fx?
Power Fx is a declarative, low-code formula language designed for use across Power Apps, Power Automate, and Dataverse. It allows users to build dynamic calculations, automate processes, and enhance data management without traditional coding.
Key Benefits of Power Fx in Dataverse?
✅ No-code/low-code approach – Reduces dependency on developers.
✅ Real-time calculations – Ensures instant updates when data changes.
✅ Easy-to-learn – Based on Excel-like formulas.
✅ Seamless integration – Works across Microsoft’s Power Platform ecosystem.
Example: Calculating Age Using Power Fx in Dataverse
Step 1: Create a Date of Birth field.
-
Go to Power Apps -> Tables -> Select your Preferred table (e.g., Contact).
-
Click Columns -> New Column
-
Set the following details
- Display Name: Birthdate
- Behavior: Simple
- Data Type: Date Only
- Click Save & Close
Step 2: For the Age Field
-
Click New Column
-
Set the following details
-
Display name: Age
-
Data Type: Formula
-
Formula:
(Note: Birthdate represents the field name for the birth date field.)
If(IsBlank(Birthdate), Blank(),If(
(Month(UTCToday()) > Month(Birthdate)) ||
(Month(UTCToday()) = Month(Birthdate) && Day(UTCToday()) >= Day(Birthdate)),
Year(UTCToday()) - Year(Birthdate),
Year(UTCToday()) - Year(Birthdate) - 1
)
)
-
Now, Click on the Advanced options, present at the end
-
Set Formula Data Type as Whole number.
-
Click Save & Close.
Step 3: Testing the Age Calculation
-
Open your form.
-
Create a new record and enter the Date of Birth.
-
Click Save.
-
Check the updated value in the Age field.
Conclusion:
With Power Fx, customizing Dataverse has never been easier. By using simple formulas organizations can implement real-time business logic, such as calculating Age from Date of Birth, without writing complex code. This approach makes applications more dynamic, user-friendly, and maintainable.