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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Speed up or replace count distinct

Hi,

in my load script I generate a calender with miscellaneous fields (eg. date, week, year, month, ...).

Then I link my sales data with this calender.

In one of my charts I have to calculate with the number of the selected Weeks.

For this purpose I use the formula count(distinct week).

Due to the fact that every record is linked with a week in my calendar this calculation is very slow.

According to Quick Tip #5 the use of count distinct forces QlikView to use only one core for calculation.

Is there a possibility or workaround to speed this up?

Thanks in advance

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Create a table as

     WeekTable:

     Load * inline

     [#Week,Week

     1,1

     1,2

     1,3

     1,4

     1,5

     1,6

     1,7

     ..

     .

     .

     1,54];

Then use Expression as Sum(#Week) instead of Count(Distinct Week)

Celambarasan

View solution in original post

2 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Create a table as

     WeekTable:

     Load * inline

     [#Week,Week

     1,1

     1,2

     1,3

     1,4

     1,5

     1,6

     1,7

     ..

     .

     .

     1,54];

Then use Expression as Sum(#Week) instead of Count(Distinct Week)

Celambarasan

Not applicable
Author

Hi,

thank you very much.

I tried something like this before, but I generated the table based on my calender.

In turn I got the same amount of Records as I had in the Calendar-Table.

ok, sometimes one shouldn't think so diffcult and take the easy way