Creating SUMIFS

Ok, first I have to say thank you to everyone that has helped. I have taken way more then I have given in this community, and I really appreciate it.

Now onto the problem. Iโ€™m trying to create something similar to a sumifs function by using a Sum function with a select function, but Iโ€™m failing miserably. Here is the function that I have, but itโ€™s not returning anything.

sum(
select(
employee ledger[employee pay],
and(
[_thisrow].[eid]=any(employee ledger[EID]),
or(
any(employee ledger[activity])=โ€œAM Dailyโ€,
any(employee ledger[activity])=โ€œPM Dailyโ€))))

0 9 1,217
9 REPLIES 9

Hi @School_Bus
What happens in the expression tester with this expression?
Do the parts work if you break it down?

When I test the expression I donโ€™t get any responses for any record.

I tried running just the select function, and I get no responses for any of my records. So I know itโ€™s a problem with my select function, but Iโ€™m lost on the problem. Admittedly I am just learning how to use Select, and itโ€™s kicking my butt.

Steve
Platinum 4
Platinum 4

What are you trying to accomplish with your SUMIF()?

Iโ€™m trying to create a sumifs for payroll. I figured it out, it was the first condition after the and function that was binding my expression. Looks like itโ€™s up and running now.

thank you

So I tried to add a function in to filter using the date, but it really just returns everything. Can you tell me whatโ€™s wrong with my function? I suspect itโ€™s the any() function causing me issues, but I donโ€™t know how to get the expression to work. Thanks in advance

Sum(
select(
employee ledger[driver cost],
and(
[_thisrow].[eid]=[eid],
any(company payroll[w1start])<=[date],
any(company payroll[w1end])>=[date],
any([activity])=โ€œTripโ€
)))

Have you read this?

All of it?

Yep, I got that it returns just one arbitrary value, but the table Iโ€™m pulling from only has a single record. I figured by using Any() I would just be left with that value from the single record. I donโ€™t know what to do with this, and why itโ€™s returning all instances where activity = trip. I just tried removing the any function from [activity]=โ€œTripโ€ since itโ€™s comparing a list to a value.

So when I used the ANY function it was an attempt to overcome the problem where list <> value in the select function. I think this is caused by me using a table to column function โ€œcompany payroll[w1start]โ€

It looks like a similar question has come up in the past that you were in the conversation on, but it doesnโ€™t look resolved. Since ANY() is just returning an arbitrary number in the list, how should I go about resolving the conflict where a value cannot be compared with a list?

Iโ€™ve linked the previous discussion thread for reference. Thanks in advance for the help

I think itโ€™s resolved now. I am trying to use a filter table for the dashboard with this, and that means I had to reference two separate tables in the same select function. Soโ€ฆ I created virtual columns for my w1start, w1end, etcโ€ฆ in this sheet that used a lookup to get the value from my filter table. Then I went back to my select function and removed that external table reference and was able to fix my search function that way. At least I think, Iโ€™ll have to try to break it tomorrow, but it looks like it works now

Top Labels in this Space