cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chriscarter
Frequent Visitor

Power FX Formula columns in Dataverse

Hello guys
Please help in dataverse formular

 

I have a dataverse table that contains information like :
initial amount, entry amount, expense amount and final amount

PS : The final amount = Initial amount + Entry amount – Expense amount

I have already written the final amount formula in the calculated column of dataverse

 

Every day there is an initial amount

So , Today's initial amount must be equal  to yesterday final amount

 

My difficulty is to be able to automate the display of the initial amount each day
I would like the value of today's initial amount to automatically be the same value of yesterday's final amount
Anyone have an idea how to do it?

1 ACCEPTED SOLUTION

Accepted Solutions
dpoggemann
Most Valuable Professional
Most Valuable Professional

Hi @Chriscarter ,

 

Here are the details...  I tested out and it worked great.  

  1. Create Workflow (you will find in the "New --> Processes" section and it is called Workflow.  Note, when creating these it is the classic interface and will be slow to author.
  2. When creating this some key settings you will want is to:
    1. Set the scope to Organization level so it will kick off for any user
    2. Verify you uncheck the "Record is created" checkbox
    3. Select the Record Field Change checkbox and then Select your field to kickoff the workflow.  In my example I actually did it on the Status Reason column on the table and then when the current record is changed to a status reason of "Completed" it will create the new record (this if check is in the action steps section.
  3. Setup the steps for the workflow
    1. My first step is a Condition that will see if the status reason is Completed and if it is then it will continue
    2. The next step calls the action to Create a Record and I selected the same table (Test1) in my case
    3. Set the Properties for the new record, see my screen shot
      1. I set the Date to one day after the current date on the record
      2. I set the Initial Amount on the new record to the value of the current record's Final Amount
      3. Set the other values to $0.00 for the Expense and the Entry amounts
      4. Set the Name to the Date - Entry (although I set to current date so this wasn't exactly right :). You can adjust to set the name to whatever you want...
  4. Activated the Workflow

Following are screen shots of all the setup:

Screenshot 2023-03-11 at 7.18.01 AM.png

 

I tested it and it worked as expected when I changed the status reason to Completed on the current record it created the new record for me.

Screenshot 2023-03-11 at 7.26.17 AM.png

 

Some thoughts for when you do this to even make it better:

  1. Setup another field on the table that is called "Next Day Created" and have this be a "Yes/No" field that is behind the scenes.  
  2. Add a step after creating the new record to do an "Update Record" and update the current record to set this field to "Yes".
  3. Change the initial condition to create new records to be an "AND" with the current check on the status reason (or whatever field you are using) and secondly that the value of the "Next Day Created" field is "No".  This way you won't duplicate records if someone happens to change the Status Reason back to Active and then to Completed again.

 

 

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew

View solution in original post

8 REPLIES 8
dpoggemann
Most Valuable Professional
Most Valuable Professional

Hi @Chriscarter ,

 

Couple thoughts / options here...

  1. Create a Power Automate flow that will look at yesterday's record and create a new record for next day with the initial amount at the "Final Amount" from prior day.  You could then schedule this nightly to create the new record and populate it.
  2. If you wanted to create the new record on demand you could create a classic realtime workflow that would create the new record based on changing a value on the current record like "Create tomorrow's record" and when this field is set to true it would create the next day's record in the workflow setting initial value to the final amount value from the record you are on.
Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew

Hello @dpoggemann 

Thanks for your answer

But

I don't really understand the second option and I can't materialize it as you say. please can you explain it in detail and show a concrete example of the rules (how I can do it)

 

Thanks

dpoggemann
Most Valuable Professional
Most Valuable Professional

Hi @Chriscarter ,

 

Here are the details...  I tested out and it worked great.  

  1. Create Workflow (you will find in the "New --> Processes" section and it is called Workflow.  Note, when creating these it is the classic interface and will be slow to author.
  2. When creating this some key settings you will want is to:
    1. Set the scope to Organization level so it will kick off for any user
    2. Verify you uncheck the "Record is created" checkbox
    3. Select the Record Field Change checkbox and then Select your field to kickoff the workflow.  In my example I actually did it on the Status Reason column on the table and then when the current record is changed to a status reason of "Completed" it will create the new record (this if check is in the action steps section.
  3. Setup the steps for the workflow
    1. My first step is a Condition that will see if the status reason is Completed and if it is then it will continue
    2. The next step calls the action to Create a Record and I selected the same table (Test1) in my case
    3. Set the Properties for the new record, see my screen shot
      1. I set the Date to one day after the current date on the record
      2. I set the Initial Amount on the new record to the value of the current record's Final Amount
      3. Set the other values to $0.00 for the Expense and the Entry amounts
      4. Set the Name to the Date - Entry (although I set to current date so this wasn't exactly right :). You can adjust to set the name to whatever you want...
  4. Activated the Workflow

Following are screen shots of all the setup:

Screenshot 2023-03-11 at 7.18.01 AM.png

 

I tested it and it worked as expected when I changed the status reason to Completed on the current record it created the new record for me.

Screenshot 2023-03-11 at 7.26.17 AM.png

 

Some thoughts for when you do this to even make it better:

  1. Setup another field on the table that is called "Next Day Created" and have this be a "Yes/No" field that is behind the scenes.  
  2. Add a step after creating the new record to do an "Update Record" and update the current record to set this field to "Yes".
  3. Change the initial condition to create new records to be an "AND" with the current check on the status reason (or whatever field you are using) and secondly that the value of the "Next Day Created" field is "No".  This way you won't duplicate records if someone happens to change the Status Reason back to Active and then to Completed again.

 

 

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew
dpoggemann
Most Valuable Professional
Most Valuable Professional

@Chriscarter ,

To launch the workflow interface.

  1. Step 1, navigate into your solution and select the navigation to create a new workflow
    Screenshot 2023-03-13 at 4.56.02 AM.png
  2. Enter the table for your workflow and make sure to "uncheck" to run in the background and select "Create"
    Screenshot 2023-03-13 at 5.00.52 AM.png
  3. This will launch a new window (watch your browser popup blocker) that will be in the classic interface for the workflow to complete the steps.  Note, again this may take a couple minutes to launch.  
Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew
Chriscarter
Frequent Visitor

Hello @dpoggemann 

Thank you very much for everything

Sorry for my silence.

I tried to reproduce what you showed me, but I was stumbled on another level

 

Let me explain my project a bit more in detail:

In my project, I am trying to set up a cash management application in contact with other departments

In the checkout application, I have 2 main forms, each of which has its own table

The data entry table and the data summary table

 

Also, in parallel, I am developing a canvas application on power apps

 

Here's how I see things:

On a daily basis, the cashier will enter incoming and outgoing transactions in a form that is connected to the data entry table

The summary table, on the other hand, contains only cumulated and calculated data which depend on the data of the data entry table

 

I have already created the 2 tables

I linked the 2 tables

I created the 2 forms on power apps

 

For the data entry table, here are the columns:

Customer's surname and first names, type of customer, type of transaction (Cash out, Cash in), amount, commission generated, observation

For the summary table, I have several columns such as: Total cash out initial balance, total cash in, total commission, final balance

 

To create total cash out in the summary table, I configured the condition:

{ if transaction in the data entry table is equal to Cash out,

Then (aggregate): SUM the amount}

 

So I would like the summary table to contain only 1 single line since these are only cumulative or calculated values. The values ​​will change depending on the selected date

 

My difficulty:

When I do a test; that's to say :

In my power apps application, when I enter data in the form, the record is created in the data entry table (dataverse), But no record is created in the summary table

I was thinking that since the tables are linked and that the validation of the data entry form contains data related to the summary table, then this should automatically create a record in the summary table. But this is not the case. Do you have any idea how to proceed please?

 

 

Looking forward to reading you very soon🤝

dpoggemann
Most Valuable Professional
Most Valuable Professional

Hi @Chriscarter ,

 

There is nothing by default that will build the summary rows in your other table with Dataverse out-of-the-box. 

 

Personally I would not recommend creating this summary table to track the totals by date and utilize Power BI do do this instead.  Power BI can connect to your Dataverse environment real time with (Direct Query) and you could easily built the type of dashboards you are looking for here where you could look at totals by date, by type of customer, by customer, etc. based on your transaction data.   The only challenge with this approach would be licensing as anyone that would use the Power BI dashboard would require a license...

 

If you had to go without using the Power BI dashboard and wanted to still create and manage these summary records in the table then I think you would need to do something through Power Automate or a custom action within Workflow.

 

High Level Power Automate Thoughts:

Question:  Do you allow updates to your transaction records?  If so, you would need a process that could update the amount on the record and be able to change and back out the prior value. Example, if they said "Cash In", "$50.00" and the updated that record to "Cash Out" "$50.00" you would need to update your summary table to back out the original $50 and then subtract another $50.

 

Assuming updates can be made to records (as mentioned above):

  1. Add "prior_amount", "prior_type", "update_processed", "prior_date", "summarized" as fields to the detail transaction table, these will keep the prior values for the type, date and amount and keep track if the prior update has been processed because you can't have someone try to update the record two times for these fields to different values if it hasn't been processed or you will lose track of the appropriate summary values.
  2. Real time workflow on detail table triggered on create or update of the (amount, type, date) fields
    1. If create of record (should be able to check if the created and updated time are same)
      1. set the update processed field to Yes
    2. If update of record and update processed = No and prior fields do not equal current field values
      1. Cancel the workflow, set error that the prior update needs to be processed first return back to user (see https://jukkaniiranen.com/2013/11/using-real-time-workflows-to-show-error-messages/
    3. else if update and update processed = Yes
      1. set update processed = No
  3. Create a Power Automate Flow that will trigger on creation or update of the detail transaction record
    1. Make sure to setup the Power Automate Flow that only one instance can run at a time
    2. On Create of the record then search for the Summary record by Date and if it does not exist then create it and set the values of the summary amounts to the amounts from the detail record appropriately (based on cash in vs. cash out).  Set the Update Processed field on the detail transaction record to "Yes" and set the prior value fields on this record to the values on the record.  
    3. On Update of the detail transaction record (only trigger on updates to the amount, date, type) and Update Processed = No then you would need to find the Summary record for the current date on the record and apply the update either adding or subtracting from the date based on the transaction record.  Next you need to look at the prior fields and apply the reverse update for these fields.  This might require you to find a different summary record because the prior values might have been for a different date if they updated the date field on the record or it could be the same date.  Set the Update Processed on the record to Yes.

This process could be tricky to accomplish as you can see.  Hopefully I am not missing something but I think in concept this would work.  Overall I would utilize the Power BI side as it would be a lot more flexible and doesn't require all this work.  Example, if you now wanted to summarize by another field like Customer Type it gets even more complicated! 

 

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew

wow

THANKS @dpoggemann 

To be honest, I'm a bit lost in your explanation. Probably because I'm new to the power platform

 

But I would like to make some comments following your explanations.

 

First of all

You talked a lot about Power Bi. I would like to remind you that in my statement I did not talk about power BI but about power apps (canvas application)

So I'm not trying to fill the cumulated column with power bi , no

But by filling out a form on power apps

 

Secondly

Your solution is really complex

But I remain convinced that what I ask is quite possible but surely I do not proceed well

Because it is a question of creating 2 tables, the connected ones, creates the cumulated columns then automatically fills the cumulation column following the actions linked to this column coming from the other table

 

It will be simpler and more convenient

 

You can try to do a simulation, create the tables, make the relationships, create the forms...

And see if it works

Surely I'm not doing well, or I miss doing something

 

THANKS

dpoggemann
Most Valuable Professional
Most Valuable Professional

Hi @Chriscarter ,

I don't think what you are trying to do is possible without the complex portions to keep the summary data up-to-date...  

 

I would be happy to do a call with you if you would like to walk through this and how Power BI could really simplify this for you if you would like. I will send you a direct message with my availability link... 

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew

Helpful resources

Announcements

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!     Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!     Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!     UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!     European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!   Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!   For more events, click the image below to visit the Microsoft Community Days website.    

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip: Community User Groups

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: Community User Groups and YOU Being part of, starting, or leading a User Group can have many great benefits for our community members who want to learn, share, and connect with others who are interested in the Microsoft Power Platform and the low-code revolution.   When you are part of a User Group, you discover amazing connections, learn incredible things, and build your skills. Some User Groups work in the virtual space, but many meet in physical locations, meaning you have several options when it comes to building community with people who are learning and growing together!   Some of the benefits of our Community User Groups are: Network with like-minded peers and product experts, and get in front of potential employers and clients.Learn from industry experts and influencers and make your own solutions more successful.Access exclusive community space, resources, tools, and support from Microsoft.Collaborate on projects, share best practices, and empower each other. These are just a few of the reasons why our community members love their User Groups. Don't wait. Get involved with (or maybe even start) a User Group today--just follow the tips below to get started.For current or new User Group leaders, all the information you need is here: User Group Leader Get Started GuideOnce you've kicked off your User Group, find the resources you need:  Community User Group ExperienceHave questions about our Community User Groups? Let us know! We are here to help you!

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!  

Users online (5,673)