cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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 @Anonymous ,

 

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 @Anonymous ,

 

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

Anonymous
Not applicable

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (3,669)