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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
balasundaram
Creator II
Creator II

My sql query to qlikview script

My SQL Query: select A,B,count(1) from bala;

i written in qlikview like

Load A,B,count(1) from bala.qvd;

is it correct ?

any function there in qlikview for my sql COUNT function

10 Replies
anbu1984
Master III
Master III

You can use Count(1) in QV


Load A,B,count(1) from bala.qvd Group by A,B;

aveeeeeee7en
Specialist III
Specialist III

Count() function is available in Qlikview

Since, its an Aggregate function so you need to use Group By clause.

eg.

Main_Table:

Load

A, B

Count(Distinct Value) AS New_Value

From Table.......

GROUP BY A,B;

Regards

Av7eN

its_anandrjs
Champion III
Champion III

Hi,

What out out get when using mysql query that is select A,B,count(1) from bala; let me knwo


And in Qlikview you can use same but need to use Group By by all dimension in table

Load

A,B,

count(1) from bala

Group By A,B;

Regards

Anand

jagan
Partner - Champion III
Partner - Champion III

Hi,


Try like this


Load A,B,

count(A)  AS Count

from bala.qvd

Group by A,B;


Regards,

jagan.

balasundaram
Creator II
Creator II
Author

bala:

LOAD * INLINE [

    sno, name

    1, a

    2, b

    3, c

    4, d

    5, e

];

b:

LOAD sno,name,count(sno)

Resident bala Group by sno,name;

drop table bala;

in qlikview iam getting count '1'

but in my sql count '5'

i have tried like count(1),count(name),count(sno),count(sno&name)...but same result in qlikview '1'

now check and tell me...

balasundaram
Creator II
Creator II
Author

bala:

LOAD * INLINE [

    sno, name

    1, a

    2, b

    3, c

    4, d

    5, e

];

b:

LOAD sno,name,count(sno)

Resident bala Group by sno,name;

drop table bala;

in qlikview iam getting count '1'

but in my sql count '5'

i have tried like count(1),count(name),count(sno),count(sno&name)...but same result in qlikview '1'

now check and tell me...

anbu1984
Master III
Master III

If Nulls are present in A, then Count() ignores that row

Set NullInterpret='';

Load A,B,Count(1),Count(A) Group by A,B;

Load * Inline [

A,B

1,1

1,1

1,2

,3 ];

anbu1984
Master III
Master III

Do you have duplicates in Mysql table?

Not applicable

It will definitely give you '1' as the output, since you are grouping it by sno and name, which  will uniquely count each row in this case since you do not have any duplicates in this.

You have to use SUM up this count in Front End charts to show or in the script create a separate table for counts:

counttable:

LOAD count(sno) as cnt

Resident bala;

Hope this was helpful.

Thanks,

Singh