cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alphahorse
Level: Powered On

Sum a column from one sharepoint list with a condition to another Sharepoint list.

Hi,

 

I have to seperate sharepoint lists. "List A" show all the orders I get in from different customers:

Screen Shot 2018-06-05 at 22.52.17.png

And sharepoint "List B" show all my customers as a single item in the list.

 

So "List A" has alot of orders not only from different customers, but also from the same customer. What I would like to do is to sum all the order values from "List A" to "List B", matching the customer name. I am simply trying to create a sharepoint list (List B) that show the total amount or result of all the orders a customer placed in Sharepoint "List A"

 

This is similar to what I do in excel when I use the function Sumif.

 

I have been trying to make this happen for a couple of days now, but I have not found any good solution to it.

 

Thanks

5 REPLIES 5
Anonymous
Not applicable

Re: Sum a column from one sharepoint list with a condition to another Sharepoint list.

This particular post includes some steps for iterating through all of the items:

 

https://blogs.msdn.microsoft.com/svarukala/2017/08/08/iterate-and-get-all-items-from-a-sharepoint-la...

 

I imagine you could then use some conditions plus a bunch of variables to start adding up the totals for each customer, with an action at the end to update the totals in List B

 

I would imagine that depending on how many unique customers you have plus how many individual sales transactions are stored in List A, this could be a time consuming flow to run.  As such, you'll want to be mindful of the trigger you are using, to ensure its not running multiples of times unnecessarily.

Community Support Team
Community Support Team

Re: Sum a column from one sharepoint list with a condition to another Sharepoint list.

Hi @ Alphahorse,

 

 

Does the value in the "Ordre Sum" column with a currency symbol “kr”?

 

Could you please take a try to add another column to save the currency symbol “kr”, and set the "Ordre Sum" column with a Number type?

 

If you could  add another column to save the currency symbol “kr”, and set the "Ordre Sum" column with a Number type, you could refer to my workaround below:

 

I have made a test on my side to create a List A as screenshot below:

Capture.PNG

Note:

The customer column is a single link of text column to save the costomer name.

The Order Single column is a Number type column to save the order money.

 

I have created a List B as screenshot below:

Capture.PNG

 

Note:

The customer column is a single link of text column to save the costomer name.

The Order Sum column is a Number type column to save the costomer's all order money.

 

I have created a flow as below:

Capture.PNG

Capture.PNG

 

Note: 

The expression in the Compose as below:

union(array(items('Apply_to_each')?['customer']),variables('customer'))

Capture.PNG

 

Note:

The "Current item" dynamic content in the screenshot is from "Apply to each 2".

 

Capture.PNG

 

Note:

The expression in the Compose 2  as below:

int(items('Apply_to_each_3')?['Order_x0020_Single'])

 

 

The flow would run successfully as below:

Capture.PNG

 

The items would be created in List B as below:

Capture.PNG

 

Please let me know if your problem could be solved.

 

 

Regards,
Alice Zhang

Highlighted
Alphahorse
Level: Powered On

Re: Sum a column from one sharepoint list with a condition to another Sharepoint list.

Hi,

 

Thank you for the reply. Your solution seems to be a good one. However, I keen getting an error message:

Screen Shot 2018-06-08 at 11.32.53.png

 

So it might seem like I am missing a value in Order By field:?

Screen Shot 2018-06-08 at 11.37.23.png

 

 

Any solutions to this?

 

 

Thank you again for your explaination.

Community Support Team
Community Support Team

Re: Sum a column from one sharepoint list with a condition to another Sharepoint list.

 

Hi @Alphahorse,

 

Please check the input in the "Filter Query" field of "Get items 2".

 

The input should be: 

Capture.PNG

 

Not:

Capture.PNG

 

 

Please take correct your flow and let me know if your problem could be solved.

 

Best regards,

Alice

 

 

 

 

 

 

 

 

 

Alphahorse
Level: Powered On

Re: Sum a column from one sharepoint list with a condition to another Sharepoint list.

Hi and Thank you for you reply.

 

I tried to replacate the flow you created and it works perfectly after I did the changes you suggested.

 

However, What I am trying to achieve is: Everytime someone in my company ads a new "order" to List A, it automatically updates the Customer in List B with the total amount. In this way, during the sell-in period, every employee can see the total amount the customer has bought for at any desirable point.

 

Your suggestion does that in a way but it is not dynamic, it only creates new items in List B if a item is created in List A.

 

In excel this is very easelly achieved by saying: "If the `customer name` in List A, is equal to the `customer name` in List B, then sum the whole `Order Single` row". However, I am not sure if this is possible using flow, maybe the logic should be something like this then: "When new item is created in List A, delete all items in List B - and then following the action you suggested in flow".

 

Is this even possible you think?

 

Thanks again for your help so far

 

 

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,246)