web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Unable to calculate To...
Power Apps
Answered

Unable to calculate Total Hours value from a particular column in collection

(0) ShareShare
ReportReport
Posted on by 32

Hi Community,

 

I am developing an application in PowerApps and I currently facing an issue to get the sum of a particular column based on another column.

I have a collection which has around 10 columns, in which, one column which has the values either Billable or Non Billable.

And I have a column called Total Hours which contains the hour values.

 

Now, I need to sum the total hours based on the billable values separately and non billable hours separately and need to display it in a text label.

 

So, what is the way to filter out a collection based on particular column value.

Kindly, help me out to solve.

 

Categories:
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @murlimanohar_k The following formula group your data into Billable/Non-Billable and give the Total for each.

    AddColumns(
     GroupBy(
    	 yourCollection,
    	 "yourBillColumn",
    	 "BillGroup"
     ),
     "Total",
     Sum(BillGroup,Value(yourHoursColumn))
    );

     

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

  • Ramole Profile Picture
    Super User 2024 Season 1 on at
  • murlimanohar_k Profile Picture
    32 on at

    Hi @CNT ,

     

    I'm bit confused with your solution.

    I have provided the  screenshot for your reference.

     

    I have used my syntax, Sum(my_Collection,Column_Name) to calculate the total hours.

     

    Likewise, I need to calculate for only billable and only non billable.

     

    This is the columns in my gallery,

    murlimanohar_k_0-1638526890018.png

     

    And in this text label, which the total value need to be shown.

    murlimanohar_k_1-1638526961156.png

     

    Thanks,
    @murlimanohar_k 

     

  • murlimanohar_k Profile Picture
    32 on at

    Hi @Ramole ,

     

    I have already referred to this query.

     

    Thanks,

    @murlimanohar_k 

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @murlimanohar_k What are the columns in my_Collection and what are their data types?

  • murlimanohar_k Profile Picture
    32 on at

    Hi @CNT ,

     

    I have one column called TempTotalHours which holds the time values in text type in minutes, and another column called BillableorNonbillable which holds value either billable or non billable in text format.

    murlimanohar_k_0-1638527855660.png

    I need to have a total value of rows which has Non Billable in a text label, and another text label which holds the total value of rows which has Billable.

     

    Thanks

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @murlimanohar_k The following formula will give you a table with 2 rows & 2 columns (Billable and its Total, NonBillable and its Total). Remember to replace yourTable with the actual name.

    ShowColumns(
    	AddColumns(
    	 GroupBy(
    		 yourTable,
    		 "BillableorNonbillable",
    		 "Group"
    	 ),
    	 "Total",
    	 Sum(Group,Value(TempTotalHours))
    	), "BillableorNonbillable", "Total"
    )

     

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

  • murlimanohar_k Profile Picture
    32 on at

    Hi @CNT ,

     

    Actually, it is not a table, it's a collection which contains those columns

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @murlimanohar_k Then put your collection name there!

  • murlimanohar_k Profile Picture
    32 on at

    How to print the value into a text label, which value should I print?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 337 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard