Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
richard24best
Creator
Creator

Multiple if condition

Spoiler
 

Hi Everyone,

I want to write the below condition in Qliksense Load script, Could you please check and advice -

IF AVG([EQ Trade Entry Comparison])>3 and AVG([CTMP Entry To Match Agreed])<12 then "Part A Late"

ELSEIF AVG([EQ Trade Entry Comparison])<5 and AVG([CTMP Entry To Match Agreed])>.5 then "Party B Late"

Thanks,

Richard

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

Wherever you are writing this condition make sure to include group by statement like below

LOAD  Field1,

             Field2,

IF (AVG([EQ Trade Entry Comparison])>3 and AVG([CTMP Entry To Match Agreed])<12,'Part A Late',

IF(AVG([EQ Trade Entry Comparison])<5 and AVG([CTMP Entry To Match Agreed])>.5,"Party B Late")) as [Late Status]

FROM/resident  Source

GROUP BY  Field1,Field2;

View solution in original post

9 Replies
PrashantSangle

try below

IF (AVG([EQ Trade Entry Comparison])>3 and AVG([CTMP Entry To Match Agreed])<12,'Part A Late',

IF(AVG([EQ Trade Entry Comparison])<5 and AVG([CTMP Entry To Match Agreed])>.5,"Party B Late"))

 

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
richard24best
Creator
Creator
Author

Hi Prashanth,

Thank you for your response.

Getting error in Data load saying invalid expression.

IF (AVG([EQ Trade Entry Comparison])>3 and AVG([CTMP Entry To Match Agreed])<12,'Part A Late',

IF(AVG([EQ Trade Entry Comparison])<5 and AVG([CTMP Entry To Match Agreed])>.5,"Party B Late")) as [Late Status]

not sure wat i am missing here.

sunny_talwar

Are you grouping the Avg() by certain fields? If you are, then you will need a group by statement

richard24best
Creator
Creator
Author

Yes Sunny, i was group these conditions into a column which i want to use in pivot.

Could you please help me out.

Regards,

Richard

sunny_talwar

Can you show the script you are using to load the this table with group by?

richard24best
Creator
Creator
Author

Apologies Sunny its a big script and cannot share here.

But i can explain you what i am looking for -

I have these columns 

EQ Trade Entry Comparison]

[CTMP Entry To Match Agreed] which gets values (1-10) based upon Party A or B touch

so i was looking if i can implement some logic based on average values and name it as separate Column to categories where it was Party A late or Party B late.

Appreciate your time and support.

In simple terms - 

(IF average of  [EQ Trade Entry Comparison] >3 and average of [CTMP Entry To Match Agreed]<12,'Party A Late '

IF average of  [EQ Trade Entry Comparison] <5 and Average of [CTMP Entry To Match Agreed]<0.5,'Party B Late ')

as [Late Status]

 

Regards,

Richard

 

sunny_talwar

I am not looking for the complete script, just the part where you load this table with the group by.

Kushal_Chawda

Wherever you are writing this condition make sure to include group by statement like below

LOAD  Field1,

             Field2,

IF (AVG([EQ Trade Entry Comparison])>3 and AVG([CTMP Entry To Match Agreed])<12,'Part A Late',

IF(AVG([EQ Trade Entry Comparison])<5 and AVG([CTMP Entry To Match Agreed])>.5,"Party B Late")) as [Late Status]

FROM/resident  Source

GROUP BY  Field1,Field2;

richard24best
Creator
Creator
Author

Thanks Kush, for your explanation and help. It works fine.

Regards,

Richard