cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NamegomJan
Helper II
Helper II

Sum function does not work properly

Hi everyone,

 

I have the following code, which worked properly until April. After I came back from my vacation it does not work anymore, and I am wondering why.

 

I have a sharepoint list (SendPoints), and am collecting the data via collmypoints. Then I am trying to Sum all the points a person received in the recent month and write it in the variable ( varMyRecPointsThisMonth). However the variable is empty even though it should output a specific value.

 

Clear(collmypoints);;
Collect(collmypoints;SendPoints);;
Set(varMyRecPointsThisMonth;Sum(Filter(collmypoints;Title=varLoginUserEmail && Month(SendDate)=Month(Now()));Points));;

 

btw. I am using German syntax.

 

Can anyone help?

13 REPLIES 13
RandyHayes
Super User
Super User

@NamegomJan 

What type of column is Points in your list?

Does the following formula produce a table of results?

    Filter(SendPoints; Title=varLoginUserEmail && Month(SendDate)=Month(Now()))

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
NamegomJan
Helper II
Helper II

Points is a Number.

 

When copying this code into a table, I will see the columns but no data in it.

 

Filter(SendPoints; Title=varLoginUserEmail && Month(SendDate)=Month(Now()))

 

 

RandyHayes
Super User
Super User

@NamegomJan 

So the issue is with your Filter, not the Sum function.

Try to break down the filter to see where the issue is coming from.

Try: 

    Filter(SendPoints; Title=varLoginUserEmail)

 

Then try: 

    Filter(SendPoints; Month(SendDate)=Month(Now()))

 

See which does and doesn't work.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
NamegomJan
Helper II
Helper II

This works:

 

  Filter(SendPoints; Title=varLoginUserEmail)

 

It seems that the month formula has some error in it, however I cannot imagine of what could be faulty, since it worked for 3 months

 

RandyHayes
Super User
Super User

@NamegomJan 

See what happens when you go on vacation 😂

 

Try the following formula and see if it produces results:

        With({_mnth: Month(Now())}, Filter(SendPoints; Month(SendDate)=_mnth)

 

See if there is an issue evaluating the Month in the filter.

 

Also, I don't know your data, but be careful with filtering by month only...May of 2021 is the Same a May of 2020.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
NamegomJan
Helper II
Helper II

No vacation from now on 😂.

 

Sorry for answering late. I tried your code. However this does not output anything.

NamegomJan
Helper II
Helper II

I think I am on the track of something. 

 

Is there a restriction on the dataset quantity when using a collection? I just inserted the collection collmypoints to the App and when I scroll down, I only see datasets until March. Nothing for April and May.

 

And this is also the timespan where the problem started despite not changing anything.

 

Thanks & regards

 

 

R3dKap
Super User
Super User

Hi @NamegomJan,

Power Apps has a limit of 500 records (max is 2000 and can be setup through the File > Advanced settings options) to be retreived by a request (Filter, Search, ...). It doesn't have any limit on how many records will be checked upon your condition (if your condition is delegable), only on the number of returned records AFTER the request has executed on the datasource side.

Meaning: if you filter a 1 million records list and the result has 6.000 records in it, only the 500 first records from this result will be returned to Power Apps.

NamegomJan
Helper II
Helper II

Hi @R3dKap 

 

thanks. But that means that the collection itsself (collmypoints) should have all the records, right? But that is not the case. Because the collection itsself without any filter does return datasets until March and not any further 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,058)