cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Community Support
Community Support

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

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
Community Support
Community Support

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

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

MitchC3 Advocate II
Advocate II

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

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (8,728)