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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
dafnis14
Specialist
Specialist

Current Month Previous year

Hi,

I wonder why using the current month doesn't work for previous year:

sum({<Month={'$(vMaxMonth)'}, Year={'$(vPreviosYear)'}>} LineTotal)

Only a date range:

sum({<Date= {">=$(vMonthStartPrevYear) <=$(vMonthEndPrevYear)"}, Year=,Month=, Date=>} LineTotal)

Thanks!

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Huh!! even the hard coding gives the incorrect result? That is very strange.... also, I made a mistake in my previous expression... Year and Month should not repeat... can you try this and see if this works

Sum({<Month={'10'}, Year={'2017'}, Date>} LineTotal)

View solution in original post

4 Replies
sunny_talwar
MVP
MVP

May be you have to ignore selection in Year, Month and Date just like your other expression

Sum({<Month={'$(vMaxMonth)'}, Year={'$(vPreviosYear)'}, Year, Month, Date>} LineTotal)

dafnis14
Specialist
Specialist
Author

Hi Sunny,

It doesn't help..

even writing the expression as follows gives a wrong result:

sum({<Month={'10'}, Year={'2017'},Year=,Month=,Date=>} LineTotal)

I'm getting a much larger sum then expected, but can't figure what it is..:-(

Thanks!

sunny_talwar
MVP
MVP

Huh!! even the hard coding gives the incorrect result? That is very strange.... also, I made a mistake in my previous expression... Year and Month should not repeat... can you try this and see if this works

Sum({<Month={'10'}, Year={'2017'}, Date>} LineTotal)

dafnis14
Specialist
Specialist
Author

Great, Sonny!

"Year and Month should not repeat" - made my day!

Thank you!