Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm having a table which contains data as, brand prescribed for users.
for example:
I have data like this,
Username BrandName Date
xxx aaa 30/05/2015
zxc bbb 01/06/2015
zzx aaa 02/06/2015
zsd ccc 03/06/2015
ssxc ccc 04/06/2015
sas aaa 05/06/2015
dfdf bbb 06/06/2015
dsd bbb 07/06/2015
fsd aaa 08/06/2015
sas ccc 09/06/2015
Now i want to get the average duration of each brandname.
i.e Brand name 'aaa' is prescribed 4 times totally.
I need to get the day interval between its prescription date and to find the average.
like,
Sum of time interval = (02/06/2015-30/05/2015) + (05/06/2015-02/06/2015) + (08/06/2015-05/06/2015)
average = Sum of time Interval / count(Dates).
Kindly help me to achieve this.,
whether by set expression or by script.,
Thanks in advance
Regards
Adith
Try avg(aggr(Interval(max(Date)-min(Date))/count(Date),BrandName)). See attached qvw.
Try avg(aggr(Interval(max(Date)-min(Date))/count(Date),BrandName)). See attached qvw.
you can make a straight table chart with
dimension BrandName
expression (max(Date)-min(Date)) / count(Date)
Thanks Gysbert !!!
It worked fine.
Regards,
Adith