Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Simple sum/group by giving wrong results

Can someone give me a reason why the SumReadPassed column does not give me a correct result?

The Passed_both_num consists of only "0" and "1". Each Employee initials appear max. 4 times - but still my sum is returning values from 1 to 45 (should not be possible)

Anything wrong with my Group By / Sum script???

TABLE:

     LOAD [Employee ID],
    
Name,
    
Num#([Passed_both]) as Passed_both_num,
    
[SOP ID],
    
[SOP Task Code],
    
[SOP Revision],
    
[SOP Due Date],
    
[SOP Sign Date],
    
[SOP Taken On Time],
    
[SOP Status],
    
[Test ID]

FROM
\\BE_training.qvd
(
qvd);

SUM:

LOAD[Employee ID],

SUM (Passed_both_num) AS SumReadPassed

RESIDENT
TABLE

GROUP BY[Employee ID];

COUNT:

LOAD[Employee ID],

TEXTCOUNT (DISTINCT ([SOP ID])) AS CountSOPID

RESIDENT
TABLE

GROUP BY[Employee ID];   

4 Replies
Sokkorn
Honored Contributor

Re: Simple sum/group by giving wrong results

Hi gia_qlikview,

Just give script a try

SUM:
NoConcatenate

LOAD[Employee ID],

SUM (Passed_both_num) AS SumReadPassed

RESIDENT
TABLE

GROUP BY[Employee ID];

Or

SUM:
NoConcatenate

LOAD[Employee ID],

SUM (Distinct Passed_both_num) AS SumReadPassed

RESIDENT
TABLE

GROUP BY[Employee ID];

Regards,

Sokkorn

anandathome
Contributor

Re: Simple sum/group by giving wrong results

I don't think you explicitly need to convert [Passed_both] to Num.

Simple sum and group by would work.

In the table viewer, right click on "Sum" table and view data.

This should give you a clear view, where it is going wrong.

Not applicable

Re: Simple sum/group by giving wrong results

qvd file was incorrect.. but thanks anyway!

Sokkorn
Honored Contributor

Re: Simple sum/group by giving wrong results

Hi gia_qlikview,

That a problem. Great you can figure it out.

Cheer!!!

Sokkorn

Community Browser