Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have data like this
Date Noindiv
20110101 123123123
20110101 423423423
20110107 45t4terterter
20110107 123123123
20110107 423423423
I would like to count the number of Noindiv and compare it with the date 7 days before
Date daycount 7days before daycount
20110107 3 2
Any idea ?
I am trying to use a set analysis function, but it does not work.
Thanks
Philippe
Maybe you could use this:
temp:
LOAD * INLINE [
Date, Noindiv
20110101, 123123123
20110101, 423423423
20110107, 45t4terterter
20110107, 123123123
20110107, 423423423
];
temp2:
load Date,
count(Date) as CountDate
resident temp
group by Date
order by Date;
drop table temp;
Data:
load Date,
CountDate,
if(Date<>previous(Date),previous(CountDate)) as PreviousCount
resident temp2;
drop table temp2;
It will be:
Date
daycount = count(Noindiv)
"7 days before count" = count({$<Date={"$(=date(Date-7))"}>} Noindiv)
Edit: Assuming that you select one Date.
Thanks Michael for the answer.
What would be the answer if I do not select any date but I want to show the difference between the two dates in a graph ?
Thanks
Philippe
Maybe you could use this:
temp:
LOAD * INLINE [
Date, Noindiv
20110101, 123123123
20110101, 423423423
20110107, 45t4terterter
20110107, 123123123
20110107, 423423423
];
temp2:
load Date,
count(Date) as CountDate
resident temp
group by Date
order by Date;
drop table temp;
Data:
load Date,
CountDate,
if(Date<>previous(Date),previous(CountDate)) as PreviousCount
resident temp2;
drop table temp2;
Thanks a lot ,
That works well !!!
Philippe