cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MitchC3
Advocate II
Advocate II

Sum if two fields in separate SharePoint lists match using Sum(ShowColumns(Filter()

New to PowerApps-

 

I have two SharePoint lists that have a Master-Detail relationship. The master has an ID column that SharePoint generates. The detail has a lookup column to select that ID if the line item is a member of that order.

 

On the detail screen of the master in my app, I want to show the sum of all extended price fields (in the detail list) for that master item. As far as I know, I am just missing a functioning logical test-

 

Sum(ShowColumns(Filter('Name of detail list here', true = true), "Extended_x0020_Price"),Extended_x0020_Price)

 

This returns a sum of all extended prices currently in my detail list. I have tried every variant of if ID = lookupID for the logical test that I can think of, but get invalid argument type or cannot evaluate remotely errors. I need only the sum of extended prices for the items that have a lookup ID that match the ID of currently viewed master detail screen item.

 

I also need to write this value back to the master list in SharePoint, but I will come across that bridge when I get there.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @MitchC3,

 

Could you please share more details about your two SharePoint lists?

Further, could you please show a bit more about your app's configuration?

 

I have made a test on my side, please take a try with the following workaround:1.JPG

 

Within Display Form of the Detail Screen of the master in my app, I add a Custom DataCard control within the Display Form as above.

 

Within the Custom DataCard control, add two Label controls. The Text property of the first Label control set to following formula:

 

"Sum of Price"

The Text property of the second Label control set to following formula:

 

 

Sum(Filter('20180618_case1_Details',Product_x0020_Category.Value=Text(ThisItem.ID)),Extended_x0020_Price)

 

or 

 

Sum(ShowColumns(Filter('20180618_case1_Details',Product_x0020_Category.Value=Text(ThisItem.ID)),"Extended_x0020_Price"),Extended_x0020_Price)

 

2.JPG

 

 

 

Note: The '20180618_case1_Details' represents the name of detail list on my side, the Product Category is a Lookup type column in my Detail list, the Extended Price is a Number type column in my Detail list.

 

On your side, you should type the following formula:

 

Sum(ShowColumns(Filter('Name of detail list here',LookUpColumn.Value=Text(ThisItem.ID)), "Extended_x0020_Price"),Extended_x0020_Price)

Note: I assume the LookUpColumn is the Lookup type column in your Detail list.

 

 

More details about adding a Custom DataCard in Display Form (Data Form), please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-cards#customize-a-card

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xida-msft
Community Support
Community Support

Hi @MitchC3,

 

Could you please share more details about your two SharePoint lists?

Further, could you please show a bit more about your app's configuration?

 

I have made a test on my side, please take a try with the following workaround:1.JPG

 

Within Display Form of the Detail Screen of the master in my app, I add a Custom DataCard control within the Display Form as above.

 

Within the Custom DataCard control, add two Label controls. The Text property of the first Label control set to following formula:

 

"Sum of Price"

The Text property of the second Label control set to following formula:

 

 

Sum(Filter('20180618_case1_Details',Product_x0020_Category.Value=Text(ThisItem.ID)),Extended_x0020_Price)

 

or 

 

Sum(ShowColumns(Filter('20180618_case1_Details',Product_x0020_Category.Value=Text(ThisItem.ID)),"Extended_x0020_Price"),Extended_x0020_Price)

 

2.JPG

 

 

 

Note: The '20180618_case1_Details' represents the name of detail list on my side, the Product Category is a Lookup type column in my Detail list, the Extended Price is a Number type column in my Detail list.

 

On your side, you should type the following formula:

 

Sum(ShowColumns(Filter('Name of detail list here',LookUpColumn.Value=Text(ThisItem.ID)), "Extended_x0020_Price"),Extended_x0020_Price)

Note: I assume the LookUpColumn is the Lookup type column in your Detail list.

 

 

More details about adding a Custom DataCard in Display Form (Data Form), please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-cards#customize-a-card

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank you, I changed my lookup column to a number field and found a different workaround. I've realized a lookup column for my purposes would become to lengthy anyway.

Helpful resources

Announcements
PA 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

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

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 Solution Authors
Top Kudoed Authors
Users online (2,154)