Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to avoid the distinct

Hi All,

I have one table:

YearMonth, MemberId, LoginMinutes

2013-1,123,300

2013-1,123,500

2013-1,125,500

2013-2,123,900

And I want to use one pivot table to show how many unique visitor to login the web site:

But now I use YearMonth as the Dimension and use count(distinct MemberId) as the expression.

However, I heard that use distinct is not efficient, could you suggest which expression should be used to instead of distinct?

Thanks.

6 Replies
Anonymous
Not applicable
Author

Hi Isaac,

This blog may give you the answer you seek:

http://community.qlik.com/blogs/qlikviewdesignblog/2013/10/22/a-myth-about-countdistinct

Cheers,

Rod

Anonymous
Not applicable
Author

Hi Isaac,


Can give some example for expect result?

Regards,

Jerry

Anonymous
Not applicable
Author

Is the performance of the application slower than desired?  If so, you may need to move some of the expression into the script itself.  Otherwise the Distinct issue is a myth as Rod pointed out.

jagan
Luminary Alumni
Luminary Alumni

Hi Isaac,

If you want to avoid DISTINCT then do the following

Data:

LOAD

YearMonth, MemberId, LoginMinutes

FROM SourceData;


Members:

LOAD Distinct MemberId,

1 AS MemberFlag

RESIDENT Data;


Now you can just use


Sum(MemberFlag) to get the distinct count of users.


Regards,

Jagan.



qlikpahadi07
Specialist
Specialist

Hi,

Personally, You have made correct statement for distinct. I always do the same way never thought of that it is not efficient or need to change.

Not applicable
Author

hi,

Try this exp...

aggr(NODISTINCT count(DISTINCT MemberId), YearMonth)