Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

simple logical one

Item_description    Item_display_code

Close              123

Open                   34

Match                 35242

discrete              76534

i have two columns in the table and i need case/ if statement

SUM (CASE Item_description WHEN 'close' THEN Item_display_code ELSE 0 END) as close_

how to write to CASE statement and If statement for in the Qlikview script for the above example.

pls help me out

1 Solution

Accepted Solutions
Not applicable
Author

Thanks Amit Saini,

I got the approach

Tq vmuch for your solution

View solution in original post

5 Replies
amit_saini
Master III
Master III

Like this???

Thanks,
AS

Not applicable
Author

yeah but i need that expression in the script area not in the expression part

i need like this

SUM (CASE Item_description WHEN 'close' THEN Item_display_code ELSE 0 END) as close_K,

SUM (CASE Item_description WHEN 'Open' THEN Item_display_code ELSE 0 END) as open_K,

i need to have column names if that expression matches then i need to rename the if condition as the above

so, i need if () in scripting area

amit_saini
Master III
Master III

Try something like this:

tbl1:

LOAD [Doc ID],

     [01_CTT_Buying and Selling of Enron Stocks],

     [01_CTT_Enron Securities],

     [01_CTT_Privileged],

     [01_CTT_Relevant]

FROM

(ooxml, embedded labels, table is Master);

left join

LOAD [Doc ID],

     [01_CTT_Buying and Selling of Enron Stocks] as CT_B_S,

     [01_CTT_Enron Securities] as CT_E,

     [01_CTT_Privileged] as CT_P,

     [01_CTT_Relevant] as CT_R

FROM

(ooxml, embedded labels, table is Answer);

Tbl2:

Load [Doc ID] as [Doc ID],

if([01_CTT_Buying and Selling of Enron Stocks]=CT_B_S,'YES','NO') as [01_CTT_Buying and Selling of Enron Stocks],

if([01_CTT_Enron Securities]=CT_E,'YES','NO') as [01_CTT_Enron Securities],

if([01_CTT_Privileged]=CT_P,'YES','NO') as [01_CTT_Privileged],

if([01_CTT_Relevant]=CT_R,'YES','NO') as [01_CTT_Relevant],

if([01_CTT_Buying and Selling of Enron Stocks]=CT_B_S and [01_CTT_Enron Securities]=CT_E

and [01_CTT_Privileged]=CT_P and [01_CTT_Relevant]=CT_R ,'YES','NO') as Tot_Rst

Resident tbl1;

Thanks,

AS

Not applicable
Author

Thanks Amit Saini,

I got the approach

Tq vmuch for your solution

amit_saini
Master III
Master III

Happy to help you