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

How to get distinct record number from a table


Hi,

      This is the first time I add multiple tables into Qlikview. I used to merge all the data into one query by all kinds of joins. My questions is how to get distinct number of record from one of the tables. Thanks

Longmatch

4 Replies
Nicole-Smith

Pass whatever field that makes your record distinct into:

fieldvaluecount(fieldname)

Returns the number of distinct values in a field. Fieldname must be given as a string (e.g. a quoted literal).

Example:

let x = fieldvaluecount('Alfa');

Not applicable
Author

I have two tables in my app with same field of hospitalaccountID - table1 and table2. There are multiple records for a single hospital account id in table 2. I want to count unique hospitalaccountid in table2. I think the two tables will be joined by common data field - hospitalaccountid. Can we access data field by table name or is there any other way around? Thanks

Nicole-Smith

If you load table2 in first in your load script, then use

let x = fieldvaluecount('hospitalaccountID');

you will store the number of distinct hospitalaccountID in variable x

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If you have another field in the same table that doesn't contain null values you can use that in an expression like this:

count({<OtherFieldInSameTable={'*'}>} distinct hospitalaccountID)


talk is cheap, supply exceeds demand