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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
pnn44794
Partner - Specialist
Partner - Specialist

Error In Expression - Syntax Error? Unable To Determine

Hello:

Qlikview is saying there an Error In Expression for the following expression:

=If((Approval_Year='2017', SUM(SAN))
If(Approval_Year='2017',SUM(NAS))
If(Approval_Year='2017', SUM(Backup)))

Qlikview puts a red squiggly line under the comma right after the first '2017'.  I believe I have all the parentheses matched up.

What I'm trying to accomplish is to Sum the SAN, NAS or Backup values and then hopefully group them by CIO in a Bar chart.  The grouping I'll worry about after getting the expression fixed, though I'm open to any suggestion on that piece too.  Finished product would look similar to the following:

   

CIO
Backup
Smith NAS
SAN
Jones
Adams
01020304050

As always, any and all help is appreciated.  Thanks in advance.

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

That expression will not work since Approval_Year is true for all three possibilities, so only the first Sum() will be calculated. Then, why not just use the Sum(Field) in three different expressions, dimension being CIO?

View solution in original post

10 Replies
vishsaggi
Champion III
Champion III

Try this?

= If( Approval_Year='2017', SUM(SAN),

   If( Approval_Year='2017', SUM(NAS),

   If(Approval_Year='2017', SUM(Backup))))

Not applicable

syntax is

if (

     condition, expr(),

if(

     condition, expr(),

if (

     condition, expr()

)

)

)

Not applicable

=If(

Approval_Year='2017', SUM(SAN),
If(

Approval_Year='2017',SUM(NAS),
If(

Approval_Year='2017', SUM(Backup)

)

)

)

Frank_Hartmann
Master II
Master II

see attached sample,

hope this helps

Miguel_Angel_Baeyens

That expression will not work since Approval_Year is true for all three possibilities, so only the first Sum() will be calculated. Then, why not just use the Sum(Field) in three different expressions, dimension being CIO?

sunny_talwar

You can also try set analysis

=Sum({<Approval_Year = {2017}>} SAN)

=Sum({<Approval_Year = {2017}>} NAS)

=Sum({<Approval_Year = {2017}>} Backup)

pnn44794
Partner - Specialist
Partner - Specialist
Author

Thank you Vishwarath for your reply.  I appreciate it.  Your response solved the expression error, but a couple of other responses solved the whole problem.  Again, thank you for replying.

pnn44794
Partner - Specialist
Partner - Specialist
Author

Hello Frank:

Thank you for your response.  I wish I could give credit for more than one correct answer, but I cannot.  Your response is very close to solving the whole issue, but as it turns out, I don't need to do the Approval Year with CIO dimension.  I can leave CIO as is.  To be fair, it's probably due to the way my data is set up which I did not supply example of.  Again, thank you very much for your response.

pnn44794
Partner - Specialist
Partner - Specialist
Author

Thank you Miguel.  I was over complicating it again.  Sigh.  I appreciate your help and your suggestion works perfectly.  Thank you very much.