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

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,489)