Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
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.

1 Solution

Accepted Solutions
michael_maeuser
Partner Ambassador
Partner Ambassador

have you checked if the expression works?

View solution in original post

10 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Can you attach the sample file.

Regards,

jagan.

michael_maeuser
Partner Ambassador
Partner Ambassador

try this


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

Not applicable
Author

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
Partner Ambassador
Partner Ambassador

sorry mistake


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

Not applicable
Author

Hi Michael

Im getting a syntax error

michael_maeuser
Partner Ambassador
Partner Ambassador

what kind of value are in the field children?

Not applicable
Author

numbes 1 to 30

Not applicable
Author

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

michael_maeuser
Partner Ambassador
Partner Ambassador

have you checked if the expression works?