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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

to obtain the count of distinct values in a given field.

Hi All,

Is it poosible to obrain the count of distinct values in a given field

for a given table and use that value for specifying limite  in FOR Loop

in load script.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If the field exists in only that one table then you can use fieldvaluecount:

LET vMyFieldCount = fieldvaluecount('FieldNameHere');

Otherwise you'll have to calculate the count first:

Temp:

load count(distinct FieldNameHere) as MyFieldCount resident MyTableHere;

LET vMyFieldCount = peek('MyFieldCount');

drop table Temp;


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If the field exists in only that one table then you can use fieldvaluecount:

LET vMyFieldCount = fieldvaluecount('FieldNameHere');

Otherwise you'll have to calculate the count first:

Temp:

load count(distinct FieldNameHere) as MyFieldCount resident MyTableHere;

LET vMyFieldCount = peek('MyFieldCount');

drop table Temp;


talk is cheap, supply exceeds demand