cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JayashreeKrish
Resolver II
Resolver II

GroupBy and Sum in Canvas App

I have a canvas app with simple text fields. I enter a date and values and the sum is calculated .

JayashreeKrish_0-1633087079837.png

I can enter any number of dates and values to the same and the sum is calcaulated.

Now I want to add 40 and 5 , Can u pls help with me that ?(As per screenshot)

 

The table looks like this,

JayashreeKrish_1-1633087256535.png

 

Logic: I want to group  by Case Identification and Sum the total time  and display the total in a text box 

Can someone please help ?

1 ACCEPTED SOLUTION

Accepted Solutions
JayashreeKrish
Resolver II
Resolver II


Clear(baseCollection);
Clear(firstCollection);
Clear(secondCollection);
ForAll(TimeEntryCases,
Collect(baseCollection, {
Case_ID: 'Case Identification',
Total_Time: 'Total Time'
})
);
ClearCollect(firstCollection, GroupBy(baseCollection, "Case_ID","GroupedData"));
ClearCollect(secondCollection, AddColumns(firstCollection, "Total Time Entry", Sum(GroupedData,Total_Time)));

 

 

Served the purpose

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @JayashreeKrish ,

Something like

AddColumns(
   GroupBy(
      TimeEntryCase,
      "Case Identification",
      "Data"
   ),
   "TimeTotal",
   Sum(
      Data,
      'Total Time'
   )
).TimeTotal

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz May I know what is Data in above code?

@JayashreeKrish ,

It is the table column (you can call it whatever you want) that contains all the other field from the records matching the group.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@WarrenBelz 

Is it a new column ? (It need not be present in table right ? , are  we newly added it via this  formula?)

I get the below error 

JayashreeKrish_0-1633089186030.png

 

 

 

Should this be added to OnSelect of button ?

How can I see the total value in a text box ?

Please help

JayashreeKrish
Resolver II
Resolver II


Clear(baseCollection);
Clear(firstCollection);
Clear(secondCollection);
ForAll(TimeEntryCases,
Collect(baseCollection, {
Case_ID: 'Case Identification',
Total_Time: 'Total Time'
})
);
ClearCollect(firstCollection, GroupBy(baseCollection, "Case_ID","GroupedData"));
ClearCollect(secondCollection, AddColumns(firstCollection, "Total Time Entry", Sum(GroupedData,Total_Time)));

 

 

Served the purpose

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.

Users online (5,205)