Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!
Is it possible to make range count for distinct values (like RangeSum)?
Date | Uniq Users | Uniq users for 3 day |
Day 1 | 148 | 148 |
Day 2 | 177 | 318 |
Day 3 | 199 | 501 |
Day 4 | 177 | 521 |
Day 5 | 162 | 510 |
Day 6 | 164 | 463 |
Day 7 | 149 | 448 |
... | ... | ... |
I have fields:
- Date
- count(distinct Users) as Uniq Users
I need:
- unique users in range day 1 - day 3 , day 2 - day 4 ...
Thanks in advance.
maybe a script solution could be
x1:
load * inline [
date, user
1,a
1,b
1,c
1,d
2,a
2,b
2,b
2,c
3,b
3,b
3,c
4,d
5,a
5,b
5,c
5,d
5,e
];
x2:
load
date as date2,
date + iterno() -1 as date
Resident x1
While iterno() <= 3;
make a chart with
dimension date2
expression count(distinct if(date=date2, user))
count(distinct user)
Have you already tried this:
RangeSum(Above(Count(DISTINCT Users), 0, 3))
Yes, I did.
It's a sum of all values in range , not unique ones. =(
I mean :
Count (distinct Users)_Day1 + Count(distinct Users)_Day2 + Count(distinct Users)_Day3
not equal
Count (distinct Users)_Day1-3
Right, but you are using doing a rangesum right?
maybe a script solution could be
x1:
load * inline [
date, user
1,a
1,b
1,c
1,d
2,a
2,b
2,b
2,c
3,b
3,b
3,c
4,d
5,a
5,b
5,c
5,d
5,e
];
x2:
load
date as date2,
date + iterno() -1 as date
Resident x1
While iterno() <= 3;
make a chart with
dimension date2
expression count(distinct if(date=date2, user))
count(distinct user)
date + iterno() -1 shows next 3 dates.
I change it to date - iterno() +1 and it works!
Thanks!