PowerApps allows users to create rollup filed in an entity. However, creating rollup on existing rollup fields is not allowed. I have 3 entities namely Assets, Leases, and Rental History. There is a one to many relationships between Assets to Leases and leases to rental history. Out of the box system allows you to create rollup of Rent field in rental history on lease entity. However, system doesn’t allow you to create rollup of total amount (currency rollup) on lease to Assets.
This can be achieved using flow.
-
Identify and set the frequency for the flow to execute. I have set it to run once every day
-
Because rollup should be calculated on all assets, retrieve all assets first
-
Now initialize a variable of type float to 0 and name it Income Amount
-
Loop through every asset record and perform calculations. Firstly I will update total revenue field on every asset to 0. Item ID is set to the asset in the loop.
-
Now using the asset, we will retrieve all the related lease records
-
Start another loop to parse each lease and increment the variable by the rent received rollup field. Then update Asset with total revenue
Note: This may not be optimized approach, however it is just to give an idea on how we can create custom rollups calculations using Power Automate.