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.

View solution in original post

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,474)