cancel
Showing results for
Did you mean:
Post Patron

## I have to SUM the value from Three Gallery and show it to the another gallery.

Hello,

I have 3 gallery which has a Common column as "Total Cost" in this column their is some value  which has to be added and show it to the another gallery. for example:

Gallery One - 100

Gallery Two - 200

Gallery Three - 300 and the Fourth gallery should Sum all the 3 gallery value and show it in Gallery four as -

Gallery Four - 600 .

As you can see below screenshot how it should work

13 REPLIES 13
Post Patron

Yes, These 3 column are same in all the all the data source

Super User

Initially,

Ensure that you position the formula in the location where calculations are intended to occur, whether through a any button, Onchange, or Onselect property.

You should gather the total values from all three galleries, you should use ClearCollection and ForAll function to collect and store value.

`ClearCollect(   Galcoll1,     ForAll(        Gallery6.AllItems,        {        Total1: Subtitle3.Text        }      ));ClearCollect(      Galcoll2,        ForAll(           Gallery6_1.AllItems,           {            Total2: Subtitle3_1.Text            }         ));ClearCollect(      Galcoll3,        ForAll(           Gallery6_2.AllItems,           {            Total3: Subtitle3_2.Text            }         ));`

Subtitle3, identified as a label or text input control, that displays the numerical value associated with it.

Then, Combining three collections into single collection.

`With(    {        Gal1: ForAll(            Sequence(CountRows(Galcoll1)),            Patch(                Index(                    Galcoll1,                    Value                ),                {RowNo1: Value}            )        ),        Gal2: ForAll(            Sequence(CountRows(Galcoll2)),            Patch(                Index(                    Galcoll2,                    Value                ),                {RowNo2: Value}            )        ),        Gal3: ForAll(            Sequence(CountRows(Galcoll3)),            Patch(                Index(                    Galcoll3,                    Value                ),                {RowNo3: Value}            )        )    },    ClearCollect(        CombineCollection,        AddColumns(            Gal1,            "Field2",            LookUp(                Gal2,                RowNo2 = RowNo1            ).Total2,            "Field3",            LookUp(                Gal3,                RowNo3 = RowNo1            ).Total3        )    ));`

Then, in fourth gallery you should use CombineCollection as an item.

In label or text input control you should use this Sum formula.

`Sum(ThisItem.Total1 + ThisItem.Field2 + ThisItem.Field3)`

Thanks!

If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

Post Patron

Thank You so Much It worked I can see my data Correctly now.

Post Patron

Announcements

#### Celebrating the May Super User of the Month: Laurens Martens

@LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!

#### Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!