0

Sum of values of a field of a specific date

I'm looking (and can't find) a solution to calculate the grand total of a field of a given date...

No problem illustrating this with a view, but that's no use to me since I need it as a value in a formula field

thanks!

8 replies

null
    • Fred
    • 1 yr ago
    • Reported - view

    How will you be selecting the date to filter the results by?

    • Astavakra
    • 1 yr ago
    • Reported - view

    With date I mean days … sorry 

    • Fred
    • 1 yr ago
    • Reported - view

    What is your view formula, what is the name of the field you want to filter with and what value do you want to filter on?

    • Astavakra
    • 1 yr ago
    • Reported - view

    There is no view … the field is called blue and I want the sum in a Formular field filtered by day … so how much blue‘s is there today

    thx

    • Fred
    • 1 yr ago
    • Reported - view

    You can try something like:

    let x := select TableName where datefield = today();
    sum(x.blue)
    

    Just replace the TableName with the appropriate table name and datefield with the appropriate date field name.

    If you have related records then it would look something like this if you are in the 1 side of a one to many (1:N) relationship:

    sum(relatedfieldname[datefield = today()].blue)
    
    • Astavakra
    • 1 yr ago
    • Reported - view

    Hm, it’s not so much about today … this would work, thx 

    it’s about all the entries of a similar date - fe all for June 21st 2023 - need it mainly to plan things by days … so doesn’t work with today(), but what to replace that?

     

    thx

    • Fred
    • 1 yr ago
    • Reported - view
    Astavakra said:
    it’s about all the entries of a similar date - fe all for June 21st 2023 - need it mainly to plan things by days … so doesn’t work with today(), but what to replace that

    Are you going to hard code the dates in the code? If you are then you can do something like:

    let xDate := date(YYYY,MM,DD);
    let x := select TableName where datefield = xDate;
    sum(x.blue)
    

    Are you going to have a date field in a form that you will pull the date from?

    let t := this;
    let x := select TableName where datefield = t.otherdatefield;
    sum(x.blue)
    
      • Astavakra
      • 1 yr ago
      • Reported - view

      Fred thank you, that’s it!