cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Sumproduct equivalent?

Hello,

 

I have an app to organise workload which is based on jobs, where each job is a row of data on an excel table called "Tickets" (please see Tickets.jpg attached).

 

On the app, I can assign each job to a list of employees, which is in another excel table (please see Heroes.jpg attached).

 

Thus, when the job is assigned to someone, the table "Tickets" will have the "assigned to" column value filled in with the employee name (which you choose from the list).

 

What I need is to summarise the number of hours that an employee has in total, for instance "Hulk" has 2 jobs of 1 and 3 hours, so 4 in total.

 

This is easily done in Excel with Sumproduct(), where you can even set filters if the job is already closed or if you want to add only "high priority".

 

But I have no clue how to get this done in Powerapps.

 

Would anybody be able to shed some light in the matter? Smiley Very Happy

 

Many thanks!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

You can do something like this:

Sum(Filter(Tickets, AssignTo = "Hulk"), EstimatedHours)



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

Hi @JuanFiscinaMend ,

Could you please share a bit more about the ItemsInEmployeeList that you mentioned? Is it the Excel table as your Heroes.jpg?

Do you want to calculate the toal hours for each Employee within your Tickets Table?

 

Based on the formula you provided, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Add a Data Table control in your app, set the Items property to following:

ForAll(
        EmployeeListTable,   /* <-- EmployeeListTable represents the Employees List Table mentioned in your Heroes.jpg */
{
EmployeeName: EmployeeListTable[@Name],
TotalHours: Sum(Filter(Tickets, AssignTo = EmployeeListTable[@Name]), EstimatedHours)
} )

enable the EmployeeName field and TotalHours field in your Data Table, then check if the issue is solved.

 

Best regarss,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Super User
Super User

You can do something like this:

Sum(Filter(Tickets, AssignTo = "Hulk"), EstimatedHours)



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

Hi Jeff,

 

Thanks for the reply.

 

Yes, that is along the lines of what I need.

 

I do need that to be done for every employee, and ideally not hard coding each individual name on the formula.

 

Result should be something like:

 

ForAll ( ItemsInEmployeeList, Sum ( Filter ( Tickets, AssignTo=ThisItem ), EstimatedHours ) )

 

Would this be a thing?

Hi @JuanFiscinaMend ,

Could you please share a bit more about the ItemsInEmployeeList that you mentioned? Is it the Excel table as your Heroes.jpg?

Do you want to calculate the toal hours for each Employee within your Tickets Table?

 

Based on the formula you provided, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Add a Data Table control in your app, set the Items property to following:

ForAll(
        EmployeeListTable,   /* <-- EmployeeListTable represents the Employees List Table mentioned in your Heroes.jpg */
{
EmployeeName: EmployeeListTable[@Name],
TotalHours: Sum(Filter(Tickets, AssignTo = EmployeeListTable[@Name]), EstimatedHours)
} )

enable the EmployeeName field and TotalHours field in your Data Table, then check if the issue is solved.

 

Best regarss,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hello all,

 

Thanks for the answers.

 

I ended up finding a solution where I combined bits and pieces from what you guys suggested.

 

In short, I created a new column on my table "Heroes" with the total hours that a hero has assigned. Then, when you assign a job to this person, it calculates the amount of hours this person has.

 

The variable "editassign" is set when you click on a hero name to select it. Pressing save makes the call for the function below to update the record for said hero:

 

Patch(
    Heroes,
    First(
        Filter(
            Heroes,
            Name = editassign
        )
    ),
    {
        TotalHours: (Sum(
            Filter(
                Tickets,
                AssignedTo = editassign && Status <> "Closed"
            ),
            EstimatedHours
        )),
        HighPriHours: (Sum(
            Filter(
                Tickets,
                AssignedTo = editassign && Status <> "Closed" && Priority = "High"
            ),
            EstimatedHours
        ))
    }
)

As you can see from the code, it adds additional conditions like ignoring closed jobs and there is an additional column to highlight which of assigned hours are "high priority".

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (5,732)