Category

Tuesday, February 12, 2013

Alternative to Count Distinct

Count distinct "Count( Distinct <Field Name>)" is an expensive expresssion in Qlikview. Whenever used, it turns Qlikview to use single core instead of multi-cores resulting in slow performance of the app.
By making a small change in data model we can replace COUNT DISSTINCT with SUM function and improve the app performance marginally and increase app response time to users actions.

To achive this add another field in Qlikview table having value 1 along with the field you need to count.

Example:

Bookings:
LOAD
    [Member Id],
    [Booked Date],
    [Transaction Id],
    [Booking Amount]
FROM Bookings.qvd (qvd);

"Member Count":
LOAD
    [Member Id],
    1 AS "Unique Members"
Resident Bookings;

To count distinct members
COUNT(DISTINCT [Member Id]) can be replaced with SUM([Unique Members]).


3 comments:

  1. I like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep posting qlikview online training Hyderabad

    ReplyDelete
  2. This was a very informative content posted but I feel there is a need to provide some more information about SSIS postgresql read and its uses alongwith complexities.

    ReplyDelete