Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I wonder if it is possible to use 2 aggregations.
My base values are a SUM(Sales) for a specific date and I need to sum each day between 2 dates and take an average of that list of Sum's.
Something like that, which is not working
AVG(SUM(IF(Date <= addmonths(Today(),-12),Sales,Null())) and SUM(IF(Date <= addmonths(Today(),-13),Sales,Null())))
Thank you very much.
I would try with something like
avg( {$< Date={">=$(vStartDate)<=$(vEndDate)"} >}
aggr( sum( {$< Date={">=$(vStartDate)<=$(vEndDate)"} >} Sales ) ,Date )
)
Of course, you need to calculate vStartDate and vEndDate in the first place.
Aggr is a very powerful function and, basically, lets you iterate the result of and expression over the values of a field (or a series of fields), giving back an array of results to be further aggregated (in this case by avg).
Hope it helps