cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tejasvi_munge
Post Partisan
Post Partisan

Calculations in Flow

Hi All,

I am using flow to insert data into CDS at day and monthly levels. My flow is like this- So when a record is created in "A" entity then check it is monthly of daily input and in list records, I am using dim_date table and inserting data in "B" entity accordingly. 

Tejasvi_munge_0-1606225896966.png

 

I want to do one calculation in flow. I have created a flow that inserts data at day and month level and now I want to do some calculation. Suppose I have one column named X  as shown in the below image. I want to create column Y  which has values - summation of values diagonally from column X.

So column Y will be like

1)650000

2)650000+650000 =1300000
3)1300000+650000=1950000

and so on

Tejasvi_munge_2-1606225997236.png

 

How can I do it in flow?

1 ACCEPTED SOLUTION

Accepted Solutions
ManishJain
Solution Sage
Solution Sage

Hi @Tejasvi_munge ,

 

You can do it by using Initializing two variables of type int with value being 0 with one being temp variable and other being Y . Then inside Apply to each loop use Set Variable action to set Temp variable to variable Y. Then in next step use another Set Variable action to set Y using add (X, Temp) and in update action use Variable Y. 

Please note if you are using concurrency this will not work .

 

Thanks

View solution in original post

2 REPLIES 2
ManishJain
Solution Sage
Solution Sage

Hi @Tejasvi_munge ,

 

You can do it by using Initializing two variables of type int with value being 0 with one being temp variable and other being Y . Then inside Apply to each loop use Set Variable action to set Temp variable to variable Y. Then in next step use another Set Variable action to set Y using add (X, Temp) and in update action use Variable Y. 

Please note if you are using concurrency this will not work .

 

Thanks

View solution in original post

Hi @ManishJain ,

It worked. One more doubt

Suppose, I have data like this-
Record     Val     X       Y
1               45    1         1
2               67     
Here I can update only X and Y is calculated based on X.
The first time when record 1 is updated then it shows respective X and Y.
The second time when I update record 2 then it should hold the previous value of Y. If I insert X=2 then Y =3(inserted X value + previous Y value)and the output should look like this.

Tejasvi_munge_0-1606387251190.png

Earlier I was creating data monthly so your logic didn't create any problem. But now I am updating those records to update different fields but need the same kinda calculation.



Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Kudoed Authors
Users online (3,861)