Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

complicated if statement

Hello community

I have an 'if' statement that is giving me hell, i need your help.

We have the following fields:

[Boys]

[Girls]

[#No]

[Children]

The [Children ] can have >1 [#No].

The original expression is :

((sum([Boys])-sum([Girls]))* 0.90)-avg([Boys])

Now the 'if ' statement is supposed to be something like:

If ([#No]>1,((sum([Boys])-sum([Girls]))* 0.90)-avg([Boys]),(((sum([Boys])* 0.90)-avg([Boys])))

Dimension [Children]

Some how im getting the wrong answer when [Children] has only 1 [#No]

Please help.

Tags (1)
1 Solution

Accepted Solutions
michael_maeuser
Contributor III

Re: complicated if statement

have you checked if the expression works?

10 Replies
MVP
MVP

Re: complicated if statement

Hi,

Can you attach the sample file.

Regards,

jagan.

michael_maeuser
Contributor III

Re: complicated if statement

try this


If ([#No]>1,(sum([Boys])-sum([Girls]))* 0.90)-avg([Boys]),(((sum([Boys])* 0.90)-avg([Boys])))

Not applicable

Re: complicated if statement

Hi Jagan Moan

Unfortunately I cannot attach the sample file.

I think the problem could be that i must put the 'sum' before the 'if' in the expression....

michael_maeuser
Contributor III

Re: complicated if statement

sorry mistake


If ([#No]>1,(sum([Boys])-sum([Girls]))* 0.90-avg([Boys]),sum([Boys])* 0.90-avg([Boys]))

Not applicable

Re: complicated if statement

Hi Michael

Im getting a syntax error

michael_maeuser
Contributor III

Re: complicated if statement

what kind of value are in the field children?

Not applicable

Re: complicated if statement

numbes 1 to 30

Not applicable

Re: complicated if statement

The second expressiion seems to be working Michael. I just want to verify this and I'll let you know

michael_maeuser
Contributor III

Re: complicated if statement

have you checked if the expression works?

Community Browser