Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jleefjcapital
Creator II
Creator II

Is there an if then statement I can use in Qlik Sense Load Statement?

I am working with a dataset with multiple fields of which I would like to create dimensions for two.  What is the best way to create a dimension for the fields?

I tried using an IF statement, but it results in an error.   I'm not sure what I'm doing wrong, but this is what I've tried.   Can anyone provide some insight?

Thanks!
Jes

BLS_OES:

LOAD

    State as STATE,

    AREA_NAME as MSA,

If("OCC_TITLE" = 'Accountants and Auditors',  

    EMP_PRSE as EMP_PRSE_Accountants_Auditors,

    "LOC QUOTIENT" as "LOC QUOTIENT_Accountants_Auditors",

    H_MEAN as H_MEAN_Accountants_Auditors,

    A_MEAN as A_MEAN_Accountants_Auditors,

    MEAN_PRSE as MEAN_PRSE_Accountants_Auditors,

    H_MEDIAN as H_MEDIAN_Accountants_Auditors,

    A_MEDIAN as A_MEDIAN_Accountants_Auditors, Null())

FROM [lib://Employment/MSA_M2014_dl.xlsx]

(ooxml, embedded labels, table is MSA_dl);

4 Replies
robert_mika
Master III
Master III

You can not use AS in this way

you IF statement should be in form :

logical statement,true,false

so if(If("OCC_TITLE" = 'Accountants and Auditors',  something,somethingelse) as EMP_PRSE

Can you post your data?

jleefjcapital
Creator II
Creator II
Author

This is the data I'm working with.

Thank you!

robert_mika
Master III
Master III

LOAD

    PRIM_STATE,

    State,

    AREA,

    AREA_NAME,

    OCC_CODE,

   if( OCC_TITLE= 'Accountants and Auditors', EMP_PRSE) as EMP_PRSE_Accountants_Auditors,

   if( OCC_TITLE= 'Accountants and Auditors', [LOC QUOTIENT])as LOC_QUOTIENT_Accountants_Auditors,

     ..and so one..

FROM [lib://Forum/MSA_M2014_dl.xlsx]

(ooxml, embedded labels, table is MSA_dl);

Feeling Qlikngry?

How To /Missing Manual(18 articles)

jleefjcapital
Creator II
Creator II
Author

I just realized that Qlik automatically designates the OCC_TITLE as a dimension.  How silly of me.   I was able to get the desired result from the front end.

Thank you!