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

Filter not working with SUM

Hi,

 

I have the following code as art of an HTML text:

 

"ID: " & ContractID & " SUM: " & Sum( Filter( 'RAC Reports', ContractID = 'Contract ID'), TimeUsed)

 

'RAC Reports' is a SP list, ContractID comes from a different SP list. TimeUsed is the time per report. 

For some reason it doesn't return any values:

2021-03-01 10_53_30-Window.png

However, when I hardcode the ContractID with the number (92):

 

"ID: " & ContractID & " SUM: " & Sum( Filter( 'RAC Reports', 92 = 'Contract ID'), TimeUsed)

 

I do get the Sum() of the values:

2021-03-01 10_51_39-Window.png

I do see some errors, but don't understand what the error is in the code used:

2021-03-01 10_53_01-Window.png

 

Any idea what might be happening?

Thanks,

Bart

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@xecho 

Something is going wrong with the conversion between the two.

I would suggest using the Monitor Tool and look to see exactly what is being passed in the filter criteria.

Do you still get the error messages with the Text conversion formula, even though it returns the wrong sum?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

6 REPLIES 6
RandyHayes
Super User III
Super User III

@xecho 

At first glance, I'd say to change your formula to the following:

"ID: " & ContractID & " SUM: " & Sum( Filter( 'RAC Reports', Value(ContractID) = 'Contract ID'), TimeUsed)

I am not sure what type your ContractID is, but it seems to want a numeric value.

 

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
xecho
Frequent Visitor

That's what I thought. On the SP list both are text values, and using Value() doesn't make any difference.

Thanks.

RandyHayes
Super User III
Super User III

@xecho 

If they are both text columns, then Try to convert to text instead:

"ID: " & ContractID & " SUM: " & Sum( Filter( 'RAC Reports', Text(ContractID) = 'Contract ID'), TimeUsed)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
xecho
Frequent Visitor

That doesn't work either.

 

When I use:

"ID: " & ContractID & " SUM: " & Sum( Filter( 'RAC Reports', 'Contract ID'= Text(ContractID)), TimeUsed)

The sum will be 27390 no matter what the real sum is .

RandyHayes
Super User III
Super User III

@xecho 

Something is going wrong with the conversion between the two.

I would suggest using the Monitor Tool and look to see exactly what is being passed in the filter criteria.

Do you still get the error messages with the Text conversion formula, even though it returns the wrong sum?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

xecho
Frequent Visitor

Thanks Randy,

 

I have implemented it in a different way now, not sure why the other solution was not working though.

 

Thanks again!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (68,828)