web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Substract two decimal ...
Power Automate
Answered

Substract two decimal fields

(0) ShareShare
ReportReport
Posted on by 78

Hi,

 

In dataverse I have the 2 decimal fields "purchase" and "receipt". I want to subtract them from each other and put the result in the "stock" field. The calculation must be carried out on an hourly basis. How can I do that with a power automate flow?

 

Thank you in advance.

 

Jan

Categories:
I have the same question (0)
  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    There is a new column type in Dataverse called Formula (Preview) that you might want to look at. It will allow you to put in a formula so it automatically calculates the difference between the other two columns and will always be up to date. Only issue is that it's current in Preview so not recommended for production purposes.

    grantjenkins_0-1681516266000.png

     

    Alternatively, you could have a Scheduled flow that runs every hour, retrieves all the items from your table, then updates the Stock.

     

    For this example, I'm just using one of my old tables called Pets and have added the three columns (Purchase, Receipt, and Stock - all of type Decimal number) to it.

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_1-1681516404752.png

     

    Recurrence is scheduled to run every hour.

    grantjenkins_2-1681516453745.png

     

    List rows retrieves the items from your table.

    grantjenkins_3-1681516480062.png

     

    Apply to each iterates over each of the rows and uses Update a row to update the Stock using the following expression. Note that your field names will likely be different to mine.

    sub(item()?['cra85_receipt'], item()?['cra85_purchase'])

    grantjenkins_4-1681516696275.png

     

    The result after running the flow.

    grantjenkins_5-1681516838483.png

  • Jan N Profile Picture
    78 on at

    Thank you for your detailed instructions and I managed to create the Cloud Flow.

  • Matthy79 Profile Picture
    4,180 Super User 2024 Season 1 on at

    Hello.

     

    isn‘t a calculated field in this case the thing to go?

  • Jan N Profile Picture
    78 on at

    Hello,

     

    The fields are rollup fields. That is why I need a flow.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard