
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nested aggregation not allowed
Hi, i use this code to determine which item finished in valid duration:
=if(if(Only(itemNo) and Only(finishDate), finishDate-startDate, Today()-startDate)<=validRequestDuration,1,0)
now i want to use this code to know how many item finished in valid duration:
=Count(if(if(Only(itemNo) and Only(finishDate), finishDate-startDate, Today()-startDate)<=validRequestDuration,1,0))
but its not work and show diffrent errors...
How can i get count of items that finish in valid duration?
Thanks in advanced

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You might want to use Sum instead of count, as it will currently count all occurrences regardless of being 1,0.
About the nested aggregation itself, you might want to look at set identifiers expressions in order to filter through and avoid this error, this will allow you select only the values you desire to then count them without using the if():

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, its true.
can you write my script correctly with Sum please?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@arash64a Maybe something along these lines.
In script
Tmp:
LOAD itemNo,
startDate,
finishDate,
validRequestDuration
FROM xyz;
Table:
LOAD *,
If(Flag = 0, finishDate-startDate,
If(Flag = 1, Today())-startDate) as DateDiff;
LOAD itemNo,
Only(finishDate) as finishDate,
Only(finishDate) as startDate,
Only(validRequestDuration) as validRequestDuration,
If(Count(itemNo) > 1 and Count(finishDate) > 1, 1, 0) as Flag //1 for non distinct, 0 for distinct
Resident Tmp
Group By itemNo;
DROP Table Tmp;
Expression
=Sum(If(DateDiff <= validRequestDuration, 1 , 0))
