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: 
markp201
Creator III
Creator III

Optimized count distinct...

I read about a technique to identify distinct field values.   Assuming SourceTable is loaded with carmodel field

DistinctCarmodel:

LOAD DISTINCT

  carmodel,

  Autonumber(carmodel) AS %Distinct_carmodel

RESIDENT

  SourceTable

With simple or complex set analysis, we can use

  count(%Distinct_carmodel)

or

max(%Distinct_camodel)


I tweaked this idea a bit with the following


DistinctCarmodel:

LOAD DISTINCT

  carmodel,

  Autonumber(carmodel,'distinctcarmodel') AS %Distinct_carmodel

RESIDENT

  TempSourceTable;


SourceTable:

LOAD

  carmodel,

  Autonumber(carmodel,'distinctcarmodel') AS %Distinct_carmodel

RESIDENT

  TempSourceTable;


DROP TABLE DistinctCarmodel;

The one difference is we would have to use

max(%Distinct_camodel)


0 Replies