Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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);
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?
This is the data I'm working with.
Thank you!
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?
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!