
Re: Help with strange expresion using Aggr
Stefan Wühl Feb 14, 2013 10:50 AM (in response to David Najar )At least two things to notice:
 Aggr() dimension values are sorted by load order, so you need to take care that load order (I assume you are using ID as dimension in your aggr() function) is in the order you need.
 You are calculating a difference of timestamps, so you get something back as fraction of days, a number that you are displaying only as seconds. So when comparing the result of your difference calculatin, you need to compare to an interval, too:
interval#( '18', 'ss')
so maybe in total try something like:
=interval( sum( aggr( if(Below(CTime)CTime >= interval#('18','ss'),Below(CTime)CTime),ID) ) ,'ss')

Re: Help with strange expresion using Aggr
David Najar Feb 14, 2013 11:09 AM (in response to Stefan Wühl )swuehl escribió:
At least two things to notice:
 Aggr() dimension values are sorted by load order, so you need to take care that load order (I assume you are using ID as dimension in your aggr() function) is in the order you need.
 You are calculating a difference of timestamps, so you get something back as fraction of days, a number that you are displaying only as seconds. So when comparing the result of your difference calculatin, you need to compare to an interval, too:
interval#( '18', 'ss')
so maybe in total try something like:
=interval( sum( aggr( if(Below(CTime)CTime >= interval#('18','ss'),Below(CTime)CTime),ID) ) ,'ss')
That's Great! it worked Perfectly!
Just let me tell you my mistakes (probably someone else is having similar ones):
As you said, i was taking care of converting the value in days back to seconds.
The main problem is that i was focused on do the aggregate, and then sum if condition... don't know why.
ie.
sum(if(aggr(Below(CTime)CTime,ID) >= interval#('18','ss'), aggr(Below(CTime)CTime,ID) ,0)
Please don't ask me why i was doing this way... finally it was easier than I expected. Anyway, without your help would be impossible! thx a lot !
PS also I tried comparing directly with 18 ( Below(CTime)CTime,ID) >18) without taking care of the interval# function... that's great
Thanks again!
