I have a group of items that's being created in a rule and its format is lik

I have a group of items that's being created in a rule and its format is like this:

[month = 3, year = 2013, number = 1],
[month = 3, year = 2013, number = 1],
[month = 3, year = 2013, number = 1],
[month = 3, year = 2014, number = 1],
[month = 3, year = 2014, number = 1],
[month = 4, year = 2014, number = 1],
[month = 4, year = 2014, number = 1]

I would like to get the count of the field 'number' that were created in the same month and same year. For instance if the month = 3 and year = 2014, I would like to get the count of the 'number' field for those dates. Any help would be deeply appreciated.
thanks...

OriginalPostID-106459

OriginalPostID-106459

  Discussion posts and replies are publicly visible

Parents
  • If you're looking for a specific month and year you can use wherecontains.
    EG You could return the indices that match the year of interest, the indices that match the month of interest and intersect them, and count the result. Alternatively you could do it one line like below.

    count(wherecontains(monthOfInterest,touniformstring(index(items,wherecontains(yearOfInterest,touniformstring(items.year))).month)))


    If you're looking to do this dynamically for all combinations of unique month/year, you'll have to make some expression rules and apply over them, but the same principles apply.
Reply
  • If you're looking for a specific month and year you can use wherecontains.
    EG You could return the indices that match the year of interest, the indices that match the month of interest and intersect them, and count the result. Alternatively you could do it one line like below.

    count(wherecontains(monthOfInterest,touniformstring(index(items,wherecontains(yearOfInterest,touniformstring(items.year))).month)))


    If you're looking to do this dynamically for all combinations of unique month/year, you'll have to make some expression rules and apply over them, but the same principles apply.
Children
No Data