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 Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,080)