Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

guptanupur
New Contributor II

How to give count distinct statement in qlik sense load script editor in qlik sense ?

hi ,

how to give the following query in load editor script  what are the terms to be used both in LOAD and SELECT statement -


SELECT "acc_period",

"hospital",

"nationality",

"patient_type",

"admit_status",

COUNT(DISTINCT episode_seq) AS COUNT

FROM "table name"

GROUP BY "acc_period","hospital","nationality","patient_type","admit_status" ;



2 Replies
devarasu07
Honored Contributor II

Re: How to give count distinct statement in qlik sense load script editor in qlik sense ?

Hi,

script looks fine. What is the issue here?

may be u can also try like this.

Fact:

SELECT "acc_period",

"hospital",

"nationality",

"patient_type",

"admit_status",

"episode_seq",

FROM "table name";

TotalCount:

LOAD "acc_period",Count(episode_seq) as TotCount Resident Fact Group By "acc_period"; // u can further dimension with comma


Thanks,Deva

pradosh_thakur
Valued Contributor III

Re: How to give count distinct statement in qlik sense load script editor in qlik sense ?

Hi

try this

load acc_period,

hospital,

nationality,

patient_type,

admit_status,

COUNT(DISTINCT episode_seq) AS COUNT

GROUP BY acc_period,hospital,nationality,patient_type,admit_status ;

select *      //use sql select if from database
FROM "table name"


regards

Pradosh