cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
resteve
Helper I
Helper I

Help with a formula to sum collect values

Hello,

 

I create a collection from excel Datasource with the formula: ClearCollect(GroupbyConcept; GroupBy(Tabla1; "Concepto"; "total")) 

 

But I don't know how to  Sum the prices by concept, por example:

 

Autopista: 64 €

Dieta: 117,54

 

Excel DataSource:

Excel

 

Collection 

Collection 2

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Meneghino
Community Champion
Community Champion

Hi @resteve, please try this. (Please note that you probably have to use ; instead of ,)

 

AddColumns(GroupByConcept, "SumByConcept", Sum(total, Precio))

You could even do this

ClearCollect(GroupbyConcept, AddColumns(GroupBy(Tabla1, "Concepto", "total"), "SumByConcept", Sum(total, Precio)))

Please let me know how you get on.

View solution in original post

Meneghino
Community Champion
Community Champion

Hi @resteve

I have found the solution.  The key is in your third screenshot.  You need to change the Items property from PieChart1.SeriesLabels to GroupByConcept and then the Value to Concepto.

Please let me know how you get on.

 

__.JPG

View solution in original post

7 REPLIES 7
Meneghino
Community Champion
Community Champion

Hi @resteve, please try this. (Please note that you probably have to use ; instead of ,)

 

AddColumns(GroupByConcept, "SumByConcept", Sum(total, Precio))

You could even do this

ClearCollect(GroupbyConcept, AddColumns(GroupBy(Tabla1, "Concepto", "total"), "SumByConcept", Sum(total, Precio)))

Please let me know how you get on.

Perfect, it works!

Then I need two formulas and two different buttons?

ClearCollect(GroupbyConcept; GroupBy(Tabla1; "Concepto"; "total"))

ClearCollect(GroupbyConcept;AddColumns(GroupBy(Tabla1;"Concepto";"total");"SumByConcept"; Sum(total; Precio)))

 

I add a chart but the legend is the same than chart, Can I change to concepto?. Thank you!

 

Chart

chart 2

 

chart 3

Sorry, first paragraph or question of the previous post is already solved, I can have several actions in one formula with PowerApps chaining operator: ;; (double semi-colon) but only it's necessary the second action. Thank you!

Meneghino
Community Champion
Community Champion

Hi @resteve

Yes, try changing the labels or series to Concepto, see below...

__.JPG

Hi,

I attach some screenshots because I've changed the labels and series but it doesn't work.

 

label

 

label2

 

label3

Meneghino
Community Champion
Community Champion

Hi @resteve

I have found the solution.  The key is in your third screenshot.  You need to change the Items property from PieChart1.SeriesLabels to GroupByConcept and then the Value to Concepto.

Please let me know how you get on.

 

__.JPG

Done Smiley Very Happy. Thank you so much!. This community is very helpful!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,695)