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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

comparing two dates

Good afternoon,

Is to improve the attached file?


Thanks,

Gledson

2 Replies
Not applicable
Author

Using Set Analysis would be good to try. Instead of:

if(AnoInicio5ano = 2009, Sum([Qtd Aluno]))

try

sum( {$<AnoInicio5ano = {2009}>} [Qtd Aluno])

If you wanted you could also try something like:

sum( {$1} [Qtd Aluno])

and

sum([Qtd Aluno])


Using the second would give you some flexibility.

"sum([Qtd Aluno])" gives you the sum of your current selection.

"sum( {$1} [Qtd Aluno])" gives you the sum of your previous selection.

So, if you had more than two years, say 2007, 2008, 2009 and 2010 you could select which years you wanted to compare without having a anymore than two columns in your chart.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Gledson,

Set analysis is generally better, but if syntax can be simpler to read. It would appear you have the order of the if and the sum wrong in the expression:

if(AnoInicio5ano = 2009, Sum([Qtd Aluno]))

Should read:

Sum(if(AnoInicio5ano = 2009, [Qtd Aluno], 0))

Hope that helps,
Steve