cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Michel_FO
New Member

Group table by column

Hi Everyone , 

 

I have an application that is reading a list from Sharepoint, and I would like to sum/group the values ​​of Column CP5, CP6, CP7, CP8 based on Column Model. Is it possible to do that?

Michel_FO_0-1622654970858.png

 

I tried using the group by function as follows, but it didn't work:

 

 

 

GroupBy(
    'Saldo Produção'; 
    "MODELO";"OData__x0043_P5";"OData__x0043_P6";"OData__x0043_P7";"OData__x0043_P8")

 

 

Could someone help me?

1 ACCEPTED SOLUTION

Accepted Solutions
CNT
Super User
Super User

@Michel_FO Have a look at this,

 

The original data (I pulled it from Excel, but it doesn't really matter)

CNT_0-1622663423589.png

 

The Output in PowerApps DataTable

CNT_1-1622663491248.png

 

The Formula in the Items property of the DataTable

AddColumns(GroupBy(Models, "Model", "ModelsGroup"), "CP5", Sum(ModelsGroup, CP5), "CP6", Sum(ModelsGroup, CP6), "CP7", Sum(ModelsGroup, CP7), "CP8", Sum(ModelsGroup, CP8))

 

Please remember to give a 👍 and accept the solution as it will help others in the future.

View solution in original post

7 REPLIES 7
zmansuri
Super User
Super User

Is this inside gallery? If you want to sum the numbers displaying try this:

a48.jpg

Label8_7 is the name of the label inside my gallery. What it does is. Take all the values from label8_7. Convert it to number. Sum them and display. as text on another label which is outside gallery. As you can see in pic.

Michel_FO
New Member

Hi My Friend, 

 

I'm using the data table, which brings up the values ​​from a list in sharepoint.

I'm managing to add the sum, what I wanted to achieve and join the first two lines, for example: if I were using the SQL server I would do:

Select * from table
group by model, CP5, CP6, CP7, CP8

 

Michel_FO_0-1622656422235.png

 

CNT
Super User
Super User

@Michel_FO Have a look at this,

 

The original data (I pulled it from Excel, but it doesn't really matter)

CNT_0-1622663423589.png

 

The Output in PowerApps DataTable

CNT_1-1622663491248.png

 

The Formula in the Items property of the DataTable

AddColumns(GroupBy(Models, "Model", "ModelsGroup"), "CP5", Sum(ModelsGroup, CP5), "CP6", Sum(ModelsGroup, CP6), "CP7", Sum(ModelsGroup, CP7), "CP8", Sum(ModelsGroup, CP8))

 

Please remember to give a 👍 and accept the solution as it will help others in the future.

CNT
Super User
Super User

@Michel_FO  Did you try it out? Is it working?

 

CNT
Super User
Super User

@Michel_FO Expecting some feedback! 🤔

Thanks very much!

@Michel_FO Glad to help!

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (1,673)