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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
nareshthavidishetty
Creator III
Creator III

Data Model

Hi,

Below is the script we were using but here we are calculating COUNT(APPL#) and we have this value with database it showing wrong but if just load the APP table alone it shows the right value.

Please let me know if the is wrong


APP:

LOAD

date((FCFSDT),'MM/D/YYYY') as SUB_Date,

      FCFSDT,

      COMP,

      FCAACD as Location,                                                  

  APPL# ,                                                

      FCALNB as CustomerID,

      [FCK0ST],                                          

    pick(match([FCK1ST],'R','W'),'In-store','Offsite Site (Web+Ph+Mail)') as Channel,

    pick(match([FCK0ST],'A','C','D','I','Q','U','W'),'Approved','Canceled','Declined','In Store','queued','Used','Waiting') as App_Status,

  pick(match([COMP],'CON','GEM'),'Conns Application','GE Application') as App_Category,

Year(Date(AddYears(Date(Date#('19' & Right(FCFSDT,6),'YYYYMMDD'), 'DD/MM/YYYY'), 100 * Left(FCFSDT,1)), 'M/D/YYYY')) as Year

  Date(AddYears(Date(Date#('19'&Right(FCFSDT,6),'YYYYMMDD'),'MM/DD/YYYY'),100*Left(FCFSDT,1)),'M/D/YYYY') as App_Date

                                                                            ;

SQL SELECT *

FROM AS400D75.STOPRE.GRETYYUwhere FCFSDT>='1140101';

left join (APP)

Loc:

LOAD //ADABCD as CompanyCode,

    ADAACD as Location,

    ADAUNB as Address,

    ADASTX as LocationDesc,

    //ADAGST as LocationType,

    //ADBEST as SubLocaInd,

    ADACCD as District

    ;

SQL SELECT *

FROM AS400D60.DISPDBF.DSADREP;

left join (APP)

Con:

LOAD ACA1CD as Country,

  // ACANTX as Address1,

  // ACAOTX as address2,

  ACAPTX as Zipcode,

    ACAUNB as Address

    ;

SQL SELECT *

FROM AS400D70.HEDFGS.POIUJC;

left join (APP)

State:

LOAD AEADST as State,

    AEAPTX as  Zipcode,

    AEAQTX as City,

    AEARTX as County;

SQL SELECT *

FROM AS400D60.YRDGSF.LKJHGBV;

RACAPPLI:

LOAD  APPL# as racApplicationNbr,

      [COMP] as raccomp,

    App_Category as racAppCategory,

    Location as racLocation,

    CustomerID as racCustomerID,

    FCFSDT as racFCFSDT,

    App_Status as racAppStatus,

    Channel as racChannel,

  // Month as racMonth,

    LocationDesc as rsalocdes,

  App_Date as racApp_Date,

  State as RACState,

  Zipcode as RACZipCode,

  City as RACCity

RESIDENT APP

WHERE  App_Status='Declined'and App_Category='Conns Application' ;

inner  join (RACAPPLI)

RACCust:

LOAD

    C4OZXT ,

    C4OVXT,

    Left((C4OZXT), Len(C4OZXT)-8) as racCustomerID

    ;

SQL SELECT *

FROM AS400D60.IKUJYHTG.CAC4CPP;

left join(APP)

LOAD LOCATION as Location,

    Market

FROM

(ooxml, embedded labels, table is Sheet1);

left join( RACAPPLI)

LOAD LOCATION as racLocation,

    Market as racmarket

FROM

(ooxml, embedded labels, table is Sheet1);

SSS:

left join(APP)

LOAD  Location,

    SSS_Indicator

FROM

(qvd);

SSS:

left join(RACAPPLI)

LOAD  Location as racLocation ,

    SSS_Indicator as racSSS_Indicator

FROM

(qvd);

Thanks..

25 Replies
sfatoux72
Partner - Specialist
Partner - Specialist

Cool,

But add distinct on the load script of your previous join table to don't load useless data.

raadwiptec
Creator II
Creator II

As it is a long script. check your data model and see what is the issue. it would be easier to identify .

1. Are the keys joined appropriate

2. Check for synthetic keys

3. try to use concatenate and drop fields which are iterated.

nareshthavidishetty
Creator III
Creator III
Author

Hi,

As you said we have used the Distinct in the joining table but still it gives wrong count.

APP:

LOAD

      FCFSDT,

      COMP,

      FCAACD as Location,                                                                

     APPL# ,                                                             

       FCALNB as CustomerID,

      [FCK0ST],                                                       

        ;

SQL SELECT *

FROM AS400D60.OIUYTFD.RTYUFGHI where FCFSDT>='1140101';

left join (APP)

Loc:

LOAD Distinct

    ADAACD as Location,

    ADAUNB as Address,

    ADASTX as LocationDesc,

       ADACCD as District

    ;

SQL SELECT *

FROM AS400D60.IUJHYGTFD.SDFGHJ;

Thanks..

raadwiptec
Creator II
Creator II

Can you try just with Join and try ..no Left join

sfatoux72
Partner - Specialist
Partner - Specialist

That signify that for one Location id you have different attribute. For example :

Location       Address                LocationDesc          District

049               Central Road 1     Home                      22  

049               Middle Road 3      Work                       22

If it's not normal, you have bad quality data and you need to clean them.

If its normal, load your table without the join.

nareshthavidishetty
Creator III
Creator III
Author

Hi,

Will check and let you know.

Thanks,

Sebatien