Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to Push the if statement to Script

I have a expression like below: 

COUNT

(DISTINCT(IF([Department Account Opened Date]>=$(vLastMonthstart)
AND [Department Account Opened Date]<=$(vLastMonthend) AND [Post Transaction Credit Amount]>=25,[Department Account Id])))

I would like to do this in script instead of Expression, Can you please point me in right direction

Thank you,

5 Replies
manas_bn
Creator
Creator

Let vLastMonthstart = .... //Whatever you need.

Load *,

IF([Department Account Opened Date]>=$(vLastMonthstart)
AND [Department Account Opened Date]<=$(vLastMonthend) AND [Post Transaction Credit Amount]>=25, 1,0) as Dept_Acnt_Flag

Resident Your_Table;


In the front end, Count({$<Dept_Acnt_Flag={1}>} distinct [Department Account Id])

Not applicable
Author

HI,

Try this

Check:

LOAD Count(DISTINCT Department Account Id) AS Countval;

Load

IF([Department Account Opened Date]>=$(vLastMonthstart)
AND [Department Account Opened Date]<=$(vLastMonthend) AND [Post Transaction Credit Amount]>=25,  Department Account Id) AS Department Account Id

Resident your label name;


Not applicable
Author

Hi,

You can also try like this

Check:

LOAD Count(DISTINCT Department Account Id) AS Countval;

Load

Department Account Id)

Resident your label name

Where

[Department Account Opened Date]>=$(vLastMonthstart)
AND [Department Account Opened Date]<=$(vLastMonthend) AND [Post Transaction Credit Amount]>=25

rajeshvaswani77
Specialist III
Specialist III

You have to load preceding load.

T1:

Load *, if statement;

Load

field1,

field2,

..

from tablename

Thanks,

Rajesh Vaswani

Not applicable
Author

Thanks everybody, It works