Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Writing if else statement in expression and/or script

Hi,

I am very new to QV and so I am having little trouble in doing something that is a small extension of the problem originally posted by Andrew.

What I want is, I want to show say, kick-back for each customer by multiplying the sales with kick-back rate. For example, if Customer is Bob then Sales * 16.2 else if customer is Karla then Sales * 11.0.

Something like this:

dimension  = Customer kick back
expression = sum({<Customer={'Bob'}>} Sales*16.2, else if {<Customer={'Karla'}>} Sales*11.0, else Sales*9.0 )

How can I achieve this?


Tags (2)
1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Writing if else statement in expression and/or script

Hi Syed,

Use AGGR function to achieve this as shown below.

Sum(Aggr(If(Customer='Bob',  Sum(Sales)*16.2,

         If(Customer='Karla', Sum(Sales)*11.0, Sum(Sales)*9.0))))

Regards,

Jagan.

View solution in original post

3 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Writing if else statement in expression and/or script

Hi Syed,

Use AGGR function to achieve this as shown below.

Sum(Aggr(If(Customer='Bob',  Sum(Sales)*16.2,

         If(Customer='Karla', Sum(Sales)*11.0, Sum(Sales)*9.0))))

Regards,

Jagan.

View solution in original post

Highlighted
Not applicable

Writing if else statement in expression and/or script

Thanks Jagan. It worked!

Highlighted
Contributor III
Contributor III

Re: Writing if else statement in expression and/or script

Hi,

 

It doesn't works for me? Please help