Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Range count distinct

Hi!

Is it possible to make range count for distinct values (like RangeSum)?

    

DateUniq UsersUniq users for 3 day
Day 1148148
Day 2177318
Day 3199501
Day 4177521
Day 5162510
Day 6164463
Day 7149448
.........

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.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

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)

View solution in original post

5 Replies
sunny_talwar

Have you already tried this:

RangeSum(Above(Count(DISTINCT Users), 0, 3))

Not applicable
Author

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

sunny_talwar

Right, but you are using doing a rangesum right?

maxgro
MVP
MVP

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)

Not applicable
Author

date + iterno() -1  shows next 3 dates.

I change it to date - iterno() +1 and it works!

Thanks!