Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Script Load Count + add new inline table

Hi everybody,

i got this

LS:

SQL SELECT

    ARTIKELNR,

    "KRIT_TORQ_MIN",

    "KRIT_TORQ_MAX",

    "CHK_DREHMOMENT",

    "CHK_SCHRAUBEN",

    "CHK_MONTSCHR_OB",

    "CHK_MONTSCHR_UN",

    "CHK_LOCKSTIFT",

    "CHK_RIEGEL",

    "CHK_FEDER"

FROM "PrfDat_ENTW".dbo."schalterprf_LS_agg1;

Now i wanna create a new inline Table and Count if the content is 1. I tried like this:

ERROR:

Load Count(CHK_SCHRAUBEN = 1) as Anschr;

Load Count(CHK_MONTSCHR_OB = 1) as Montschr_Oben;

Load Count(CHK_MONTSCHR_UN = 1) as Montschr_Unten;

Load Count(CHK_RIEGEL = 1) as Riegel;

Load Count(IF(CHK_RIEGEL = 0 and CHK_FEDER = 1,1,0)) as Feder;

Load Count(IF (CHK_DREHMOMENT <KRIT_TORQ_MIN or CHK_DREHMOMENT>KRIT_TORQ_MAX, 1, 0)) as Drehmoment

Resident LS;

grateful for any help!

1 Solution

Accepted Solutions
Digvijay_Singh

I don't think you need so many preceding load, you may need to try something like this, all the fields which are not used in the Count function should be treated as dimension against which you are aggregating and counting your values.


ERROR:

Load

               Count(IF(CHK_SCHRAUBEN = 1,0,1)) as Anschr;

               Count(F(CHK_MONTSCHR_OB = 1,0,1)) as Montschr_Oben;

               Count(IF(CHK_MONTSCHR_UN = 1,0,1)) as Montschr_Unten;

               Count(IF(CHK_RIEGEL = 1,0,1)) as Riegel;

               Count(IF (CHK_FEDER = 1, 0,1)) as Feder;

               Count(IF (CHK_DREHMOMENT <KRIT_TORQ_MIN or CHK_DREHMOMENT>KRIT_TORQ_MAX, 1,                0)) as Drehmoment

Resident LS

Group by ARTIKELNR,CHK_LOCKSTIFT ;

View solution in original post

2 Replies
sasiparupudi1
Master III
Master III

Load Count(CHK_SCHRAUBEN = 1) as Anschr,

Count(CHK_MONTSCHR_OB = 1) as Montschr_Oben;

Count(CHK_MONTSCHR_UN = 1) as Montschr_Unten,

Count(CHK_RIEGEL = 1) as Riegel,

Count(IF (CHK_RIEGEL = 1, 0,1)) as Feder,

Count(IF (CHK_DREHMOMENT <KRIT_TORQ_MIN or CHK_DREHMOMENT>KRIT_TORQ_MAX, 1, 0)) as Drehmoment

Resident LS;

Digvijay_Singh

I don't think you need so many preceding load, you may need to try something like this, all the fields which are not used in the Count function should be treated as dimension against which you are aggregating and counting your values.


ERROR:

Load

               Count(IF(CHK_SCHRAUBEN = 1,0,1)) as Anschr;

               Count(F(CHK_MONTSCHR_OB = 1,0,1)) as Montschr_Oben;

               Count(IF(CHK_MONTSCHR_UN = 1,0,1)) as Montschr_Unten;

               Count(IF(CHK_RIEGEL = 1,0,1)) as Riegel;

               Count(IF (CHK_FEDER = 1, 0,1)) as Feder;

               Count(IF (CHK_DREHMOMENT <KRIT_TORQ_MIN or CHK_DREHMOMENT>KRIT_TORQ_MAX, 1,                0)) as Drehmoment

Resident LS

Group by ARTIKELNR,CHK_LOCKSTIFT ;