Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Invalid Expression in Conditional Statement

I'm getting an invalid expression in my load script.  Do you see anything wrong? Thanks.

IncentivePoints:

load

[Territory Manager],

if (PriSecCat = 'Primary',

   if ([TotalVolumeLbs]/[TotalBudgetLbs] *[Points] > [Points] * [Threshold]/100,

      sum([TotalVolumeLbs]/[TotalBudgetLbs] *[Points]))) as PriPointsIndex,

if (PriSecCat = 'Secondary',

   if ([TotalVolumeLbs]/[TotalBudgetLbs] *[Points] > [Points] * [Threshold]/100,

      sum([TotalVolumeLbs]/[TotalBudgetLbs] *[Points]))) as SecPointsIndex

Resident IncentiveSummarized

Group by [Territory Manager]

01/25/12 17:35:35: 1265  IncentivePoints:
01/25/12 17:35:35: 1266  load
01/25/12 17:35:35: 1267  [Territory Manager],
01/25/12 17:35:35: 1268 
01/25/12 17:35:35: 1269 
01/25/12 17:35:35: 1270 
01/25/12 17:35:35: 1271 
01/25/12 17:35:35: 1272  if (PriSecCat = 'Primary',
01/25/12 17:35:35: 1273     if ([TotalVolumeLbs]/[TotalBudgetLbs] *[Points] > [Points] * [Threshold]/100,
01/25/12 17:35:35: 1274        sum([TotalVolumeLbs]/[TotalBudgetLbs] *[Points]))) as PriPointsIndex,
01/25/12 17:35:35: 1275  if (PriSecCat = 'Secondary',
01/25/12 17:35:35: 1276     if ([TotalVolumeLbs]/[TotalBudgetLbs] *[Points] > [Points] * [Threshold]/100,
01/25/12 17:35:35: 1277        sum([TotalVolumeLbs]/[TotalBudgetLbs] *[Points]))) as SecPointsIndex
01/25/12 17:35:35: 1278  Resident IncentiveSummarized
01/25/12 17:35:35: 1279  Group by [Territory Manager]

01/25/12 17:35:35:        3 fields found: Territory Manager, PriPointsIndex, SecPointsIndex, Invalid expression
01/25/12 17:35:35:       Error: SecPointsIndex,

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

IncentivePoints:

load

[Territory Manager],

sum( if (PriSecCat = 'Primary' and ([TotalVolumeLbs]/[TotalBudgetLbs] *[Points] > [Points] * [Threshold]/100) , [TotalVolumeLbs]/[TotalBudgetLbs] *[Points])) as PriPointsIndex,

sum( if (PriSecCat = 'Secondary' and ([TotalVolumeLbs]/[TotalBudgetLbs] *[Points] > [Points] * [Threshold]/100),  [TotalVolumeLbs]/[TotalBudgetLbs] *[Points])) as SecPointsIndex

Resident IncentiveSummarized

Group by [Territory Manager];

View solution in original post

2 Replies
swuehl
MVP
MVP

Try

IncentivePoints:

load

[Territory Manager],

sum( if (PriSecCat = 'Primary' and ([TotalVolumeLbs]/[TotalBudgetLbs] *[Points] > [Points] * [Threshold]/100) , [TotalVolumeLbs]/[TotalBudgetLbs] *[Points])) as PriPointsIndex,

sum( if (PriSecCat = 'Secondary' and ([TotalVolumeLbs]/[TotalBudgetLbs] *[Points] > [Points] * [Threshold]/100),  [TotalVolumeLbs]/[TotalBudgetLbs] *[Points])) as SecPointsIndex

Resident IncentiveSummarized

Group by [Territory Manager];

Not applicable
Author

Fantastic.  That did it.  Thanks for your help.