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

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

21 REPLIES 21
Anonymous
Not applicable

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.

v-yuazh-msft
Community Support
Community Support

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

Anonymous
Not applicable

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.

 

Hi @Anonymous,

 

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

 

 

 

 

 

 

 

 

 

Anonymous
Not applicable

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

 

 

HI im trying to the same, i have total column and weekly total column and im struggling to get the sum based on created by i.e employee email id or name, it should calculate and show the final weekly total at bottom is that possible in sharepoint list?

 

the data which im getting is from power apps 

@v-yuazh-msft 

Hi Alice,

I know this is a couple of years old so I am hoping you are still watching.

I have tried to recreate your tables and flows exactly but Compose 2 is failing with message

 

InvalidTemplate. Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '2266': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'.

 

Please would you explain what you mean to achieve by using this function and why it might fail?

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

Thank you for your help,

Guy

Actually it works perfectly well if you drop the int() function and just use 

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

 

Hi @Anonymous ,

I have recreated your List A and List B and replicated the flow you suggest but, I keep getting the following error at GetItems2:

 

stockoutlist5.png

Any idea what I am doing wrong?

Thanks,

Izzy.

Make sure you are using the current item associated with the correct get items.

I found the list offered me the wrong one until I searched for current and could see both and could see which one I needed

Hi @GuyBoswell ,

Thanks, you are correct, I had the wrong current item. Get items2 is now working but I am getting an error at the Create item step further down:

 

stockoutlist7.png

 

Did you find this? Note that I used Current Item from Apply to Each3 in this step.

Thanks,

Yzanne.

The example worked fine but struggling translating it to my own tables.  I have problems with data types.  SharePoint numeric calculated columns are treated as text by Power Automate

Hi @GuyBoswell ,

I have decided that I'm going to approach this in a completely different way. My stock tables in Sharepoint are generated by a PowerApp. I'm going to try generating the totals data I need from PowerApps rather than with a flow. I already have data from one list updating data in another so should be able to work it out. It seems so much more complicated in flow than I feel it should be!

Thanks,

Izzy.

I am a learner, not an expert. I am doing something similar, mixing up Power Apps, Power Automate and SharePoint. If I understand correctly (if a real expert is reading please correct me) doing the calculations in Power Apps means you are doing the work on the users phone. a) there are performance implications  b) you might have issues if they have an unstable connection 

I am a learner too, just marginally less rubbish with PowerApps than Flow! I don't know if there are potential performance issues but I can see there might be if you're doing something complicated. For us reliable wifi is a problem before you get into anything more detailed. But, the lists I'm dealing with are not large and the maths very simple so at the moment it seems manageable via PowerApps.

I have spent days trying to get the total I need via Flow. I've now got it working and writing to my Sharepoint list in PowerApps in about 5 minutes.

Hi @v-yuazh-msft just wanted to pass on my thanks for outlining your solution for the issue. I've just reproduced your solution to try to address a similar requirement I had.

 

Whilst I'm still a bit dizzy from the Apply to each embedded in Apply to each...I got there in the end and got exactly what I needed...even 2 years after your original response.

 

So thanks again!!!

Hello @IzzyWizz 

 

Seems that after 4 years I'm in the same place 😉 Do you have any tip how to deal with this task using Power App? Will be greateful!

Hi,

Sorry, I can't even remember what the problem was and I don't use that app anymore or have a copy of it. What are you trying to do?

Izzy.

Thank you for reply!

 

I’m looking for a solution that helps me to count the items in 1 SharePoint List and build a summary in a 2nd SharePoint List.

I thought that that Power Automate is the best option (as I do not have any knowledge in Power App) but I already spent 2 weeks on looking for a solution .. without any success 😞 

These are my lists:

I tried several different flows but I'm afraid that I have to give up..

 

Do you have any idea how I can build such flow? Or it would be easier to build power app and in the end transfer the output to the SharePoint?

 

Thanks!

 

 

AgnieszkaPoland_0-1709823234860.jpeg

Helpful resources

Announcements

Exclusive LIVE Community Event: Power Apps Copilot Coffee Chat with Copilot Studio Product Team

It's time for the SECOND Power Apps Copilot Coffee Chat featuring the Copilot Studio product team, which will be held LIVE on April 3, 2024 at 9:30 AM Pacific Daylight Time (PDT).     This is an incredible opportunity to connect with members of the Copilot Studio product team and ask them anything about Copilot Studio. We'll share our special guests with you shortly--but we want to encourage to mark your calendars now because you will not want to miss the conversation.   This live event will give you the unique opportunity to learn more about Copilot Studio plans, where we’ll focus, and get insight into upcoming features. We’re looking forward to hearing from the community, so bring your questions!   TO GET ACCESS TO THIS EXCLUSIVE AMA: Kudo this post to reserve your spot! Reserve your spot now by kudoing this post.  Reservations will be prioritized on when your kudo for the post comes through, so don't wait! Click that "kudo button" today.   Invitations will be sent on April 2nd.Users posting Kudos after April 2nd at 9AM PDT may not receive an invitation but will be able to view the session online after conclusion of the event. Give your "kudo" today and mark your calendars for April 3, 2024 at 9:30 AM PDT and join us for an engaging and informative session!

Tuesday Tip: Unlocking Community Achievements and Earning Badges

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!     THIS WEEK'S TIP: Unlocking Achievements and Earning BadgesAcross the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. These badges each signify a different achievement--and all of those achievements are available to any Community member! If you're a seasoned pro or just getting started, you too can earn badges for the great work you do. Check out some details on Community badges below--and find out more in the detailed link at the end of the article!       A Diverse Range of Badges to Collect The badges you can earn in the Community cover a wide array of activities, including: Kudos Received: Acknowledges the number of times a user’s post has been appreciated with a “Kudo.”Kudos Given: Highlights the user’s generosity in recognizing others’ contributions.Topics Created: Tracks the number of discussions initiated by a user.Solutions Provided: Celebrates the instances where a user’s response is marked as the correct solution.Reply: Counts the number of times a user has engaged with community discussions.Blog Contributor: Honors those who contribute valuable content and are invited to write for the community blog.       A Community Evolving Together Badges are not only a great way to recognize outstanding contributions of our amazing Community members--they are also a way to continue fostering a collaborative and supportive environment. As you continue to share your knowledge and assist each other these badges serve as a visual representation of your valuable contributions.   Find out more about badges in these Community Support pages in each Community: All About Community Badges - Power Apps CommunityAll About Community Badges - Power Automate CommunityAll About Community Badges - Copilot Studio CommunityAll About Community Badges - Power Pages Community

Tuesday Tips: Powering Up Your Community Profile

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!   This Week's Tip: Power Up Your Profile!  🚀 It's where every Community member gets their start, and it's essential that you keep it updated! Your Community User Profile is how you're able to get messages, post solutions, ask questions--and as you rank up, it's where your badges will appear and how you'll be known when you start blogging in the Community Blog. Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile.     Password Puzzles? No Problem! Find out how to sync your Azure AD password with your community account, ensuring a seamless sign-in. No separate passwords to remember! Job Jumps & Email Swaps Changed jobs? Got a new email? Fear not! You'll find out how to link your shiny new email to your existing community account, keeping your contributions and connections intact. Username Uncertainties Unraveled Picking the perfect username is crucial--and sometimes the original choice you signed up with doesn't fit as well as you may have thought. There's a quick way to request an update here--but remember, your username is your community identity, so choose wisely. "Need Admin Approval" Warning Window? If you see this error message while using the community, don't worry. A simple process will help you get where you need to go. If you still need assistance, find out how to contact your Community Support team. Whatever you're looking for, when it comes to your profile, the Community Account Support Knowledge Base article is your treasure trove of tips as you navigate the nuances of your Community Profile. It’s the ultimate resource for keeping your digital identity in tip-top shape while engaging with the Power Platform Community. So, dive in and power up your profile today!  💪🚀   Community Account Support | Power Apps Community Account Support | Power AutomateCommunity Account Support | Copilot Studio  Community Account Support | Power Pages

Super User of the Month | Chris Piasecki

In our 2nd installment of this new ongoing feature in the Community, we're thrilled to announce that Chris Piasecki is our Super User of the Month for March 2024. If you've been in the Community for a while, we're sure you've seen a comment or marked one of Chris' helpful tips as a solution--he's been a Super User for SEVEN consecutive seasons!   Since authoring his first reply in April 2020 to his most recent achievement organizing the Canadian Power Platform Summit this month, Chris has helped countless Community members with his insights and expertise. In addition to being a Super User, Chris is also a User Group leader, Microsoft MVP, and a featured speaker at the Microsoft Power Platform Conference. His contributions to the new SUIT program, along with his joyous personality and willingness to jump in and help so many members has made Chris a fixture in the Power Platform Community.   When Chris isn't authoring solutions or organizing events, he's actively leading Piasecki Consulting, specializing in solution architecture, integration, DevOps, and more--helping clients discover how to strategize and implement Microsoft's technology platforms. We are grateful for Chris' insightful help in the Community and look forward to even more amazing milestones as he continues to assist so many with his great tips, solutions--always with a smile and a great sense of humor.You can find Chris in the Community and on LinkedIn. Thanks for being such a SUPER user, Chris! 💪 🌠  

Find Out What Makes Super Users So Super

We know many of you visit the Power Platform Communities to ask questions and receive answers. But do you know that many of our best answers and solutions come from Community members who are super active, helping anyone who needs a little help getting unstuck with Business Applications products? We call these dedicated Community members Super Users because they are the real heroes in the Community, willing to jump in whenever they can to help! Maybe you've encountered them yourself and they've solved some of your biggest questions. Have you ever wondered, "Why?"We interviewed several of our Super Users to understand what drives them to help in the Community--and discover the difference it has made in their lives as well! Take a look in our gallery today: What Motivates a Super User? - Power Platform Community (microsoft.com)

March User Group Update: New Groups and Upcoming Events!

  Welcome to this month’s celebration of our Community User Groups and exciting User Group events. We’re thrilled to introduce some brand-new user groups that have recently joined our vibrant community. Plus, we’ve got a lineup of engaging events you won’t want to miss. Let’s jump right in: New User Groups   Sacramento Power Platform GroupANZ Power Platform COE User GroupPower Platform MongoliaPower Platform User Group OmanPower Platform User Group Delta StateMid Michigan Power Platform Upcoming Events  DUG4MFG - Quarterly Meetup - Microsoft Demand PlanningDate: 19 Mar 2024 | 10:30 AM to 12:30 PM Central America Standard TimeDescription: Dive into the world of manufacturing with a focus on Demand Planning. Learn from industry experts and share your insights. Dynamics User Group HoustonDate: 07 Mar 2024 | 11:00 AM to 01:00 PM Central America Standard TimeDescription: Houston, get ready for an immersive session on Dynamics 365 and the Power Platform. Connect with fellow professionals and expand your knowledge. Reading Dynamics 365 & Power Platform User Group (Q1)Date: 05 Mar 2024 | 06:00 PM to 09:00 PM GMT Standard TimeDescription: Join our virtual meetup for insightful discussions, demos, and community updates. Let’s kick off Q1 with a bang! Leaders, Create Your Events!  Leaders of existing User Groups, don’t forget to create your events within the Community platform. By doing so, you’ll enable us to share them in future posts and newsletters. Let’s spread the word and make these gatherings even more impactful! Stay tuned for more updates, inspiring stories, and collaborative opportunities from and for our Community User Groups.   P.S. Have an event or success story to share? Reach out to us – we’d love to feature you!

Users online (4,646)