Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to write a case when statement in my script but am having trouble getting it to work properly. Here is what I have in SQL which give me the results I would expect.
case when (((((RV_CUSTOMER_SURVEY_DATA.Data_Scale_1 + RV_CUSTOMER_SURVEY_DATA.Data_Scale_2) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_3) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_4) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_5) is NULL) then 'No Survey'
when (((((case when (((((RV_CUSTOMER_SURVEY_DATA.Data_Scale_1 + RV_CUSTOMER_SURVEY_DATA.Data_Scale_2) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_3) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_4) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_5) is NULL) then null else RV_CUSTOMER_SURVEY_DATA.Data_Scale_1 end in (1,2))
or (case when (((((RV_CUSTOMER_SURVEY_DATA.Data_Scale_1 + RV_CUSTOMER_SURVEY_DATA.Data_Scale_2) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_3) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_4) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_5) is NULL) then null else RV_CUSTOMER_SURVEY_DATA.Data_Scale_4 end in (1,2)))
or (case when (((((RV_CUSTOMER_SURVEY_DATA.Data_Scale_1 + RV_CUSTOMER_SURVEY_DATA.Data_Scale_2) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_3) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_4) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_5) is NULL) then null else RV_CUSTOMER_SURVEY_DATA.Data_Scale_5 end in (1,2)))
or (case when (((((RV_CUSTOMER_SURVEY_DATA.Data_Scale_1 + RV_CUSTOMER_SURVEY_DATA.Data_Scale_2) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_3) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_4) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_5) is NULL) then null else RV_CUSTOMER_SURVEY_DATA.Data_Scale_2 end in (1,2)))
or (case when (((((RV_CUSTOMER_SURVEY_DATA.Data_Scale_1 + RV_CUSTOMER_SURVEY_DATA.Data_Scale_2) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_3) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_4) + RV_CUSTOMER_SURVEY_DATA.Data_Scale_5) is NULL) then null else RV_CUSTOMER_SURVEY_DATA.Data_Scale_3 end in (1,2))) then 'Not Satisfied' else 'Satisfied' end as Survey_Customer_Satisfied,
Here is what I cam up with in Qlikview, which I felt was close but it's definitely not right.
,if([Data_Scale_1] + [Data_Scale_2] + [Data_Scale_3] + [Data_Scale_4] + [Data_Scale_5] = ' ', 'No Survey'
or(if ([Data_Scale_1] + [Data_Scale_2] + [Data_Scale_3] + [Data_Scale_4] + [Data_Scale_5] = ' ','null', [Data_Scale_5]
or(if ([Data_Scale_1] + [Data_Scale_2] + [Data_Scale_3] + [Data_Scale_4] + [Data_Scale_5] =' ','null', [Data_Scale_4]
or(if ([Data_Scale_1] + [Data_Scale_2] + [Data_Scale_3] + [Data_Scale_4] + [Data_Scale_5] =' ','null', [Data_Scale_5]
or(if ([Data_Scale_1] + [Data_Scale_2] + [Data_Scale_3] + [Data_Scale_4] + [Data_Scale_5] =' ','null', [Data_Scale_2]
or(if ([Data_Scale_1] + [Data_Scale_2] + [Data_Scale_3] + [Data_Scale_4] + [Data_Scale_5] =' ','null', [Data_Scale_3]))))))))))),'Not Satisfied','Satisfied' as [Survey Customer Satisfied];
If someone could kindly provide me with some advise I would appreciate it.
Thank you,
Mark
Hi,
Would you be able to share a sample data