cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sgr
Helper I
Helper I

Increment variable giving wrong result

 

I got dynamic custom HTML table generated through flow getting data from SharePoint list based on filter query as shown in below fig. Here I am able to get filter data in dynamic HTML table but I could not got the way to get Total sum value from Budget. It is giving wrong result. 

 

I tried increment variable but its not giving exact results

1st iteration , i got correct result but in 2nd iteration it is adding result of 1st iteration as well. Any idea how to solve this? IS this possible????

flow-r (2).png3.JPG

2 ACCEPTED SOLUTIONS

Accepted Solutions
rsaikrishna
Community Champion
Community Champion

@sgr 

 

Do you have any more flow actions after "Increment Variable" action?

 

Regards

Krishna Rachakonda

View solution in original post

@rsaikrishna  Thank's for your tips. It worked, I just need to set another variable sumofbudget to 0  after Style block. (i.e before apply to each for increment variable) so that in next iteration it do not take sum of previous but takes 0. CASE SOLVEDsum-solved.JPG

View solution in original post

12 REPLIES 12
ManishJain
Solution Sage
Solution Sage

Hi @sgr ,

 

Are you filtering the data by code first and then summing the data .

 

Thanks

@sgr 

 

Please check the flow execution result and check how many items the Get Items action returned in every iteration. If the Get Items return more than you expected, then something wrong in the Filter Query in Get Items action. Once you correct it, everything will be fine.

 1.JPG

 

Please let us know if you have any more questions.

 

Regards

Krishna Rachakonda

If my reply helped you solving the issue, please mark the reply as Accepted Solution.

 

@ManishJain  That what i wanted; and filtered the data first and convert to HTML.
The HTML output is fine; all the budget amount in row/column are correct result.

Only problem is sum. 

 

@rsaikrishna  as show in figure, it produced two output

in 1st output total budget sum is correct, in 2nd output it is summing total budget from previous output as well.

 

the html output is correct, i have no issues with that; it shows budget and project correctly.

 

 

rsaikrishna
Community Champion
Community Champion

@sgr 

 

In the Apply to each, before setting a variable, place a Compose action.

In the compose action, place the expression from the variable.

Then, set the variable value to the output of Compose.

5.JPG

 

NOTE: variables can not be used to set values to itself in a loop.

 

Please give a try and let me know if this works for you.

 

Regards

Krishna Rachakonda

If my reply helped you solving the issue, please mark the reply as Accepted Solution.

Hi @sgr,

 

Please use the following url to compute the sum :

 

https://powerusers.microsoft.com/t5/Building-Flows/Calculate-sum-of-multiple-numbers/td-p/334399

 

Thanks

@rsaikrishna 

 

You mean this? i got same result as before

rs-sugg.JPG

rsaikrishna
Community Champion
Community Champion

@sgr 

 

Something is missing from your screen shot.

 

Can you please share your entire Apply to each condition? I do not see where you are adding the values?

 

Regards

Krishna Rachakonda

@rsaikrishna  here is the full one..

New Project (15).jpg

rsaikrishna
Community Champion
Community Champion

@sgr 

 

Do you have any more flow actions after "Increment Variable" action?

 

Regards

Krishna Rachakonda

@rsaikrishna after increment var.. it just send email to respective one..

increment -aftr.JPG

@rsaikrishna  Thank's for your tips. It worked, I just need to set another variable sumofbudget to 0  after Style block. (i.e before apply to each for increment variable) so that in next iteration it do not take sum of previous but takes 0. CASE SOLVEDsum-solved.JPG

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,967)