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

Expression help? Compare last year and this year

Hi

I need to count items sold this year(ytd) and count items sold i the same periode last year as this year.

ex. how many sold items from 1. jan 2014 to 26. march 2014 compared to same period this year

So please help med with an expression something like this

Maybe something with last maxDate or create a variable with something like

=date(Today()-365,'DD-MM-YYYY')

Count ({<AAR={$(vPreviousYear),$(vCurrentYear)}, sameperiod??>}items)

7 Replies
MK_QSL
MVP
MVP

For This Year

=SUM({<Year=,Month=,Week=,Date = {">=$(=YearStart(Today(),0))<=$(=AddYears(Today(),0))"}>}Sales)

For Last Year

=SUM({<Year=,Month=,Week=,Date = {">=$(=YearStart(Today(),-1))<=$(=AddYears(Today(),-1))"}>}Sales)

Instead of SUM(Sales), use Count(Items) in your case..

Not applicable
Author

Hi Manish

Is it possible to make it into one expression

MK_QSL
MVP
MVP

='Current Year : ' & SUM({<Year=,Month=,Week=,Date = {">=$(=YearStart(Today(),0))<=$(=AddYears(Today(),0))"}>}Sales)

& CHR(10) &

'Last Year : '& SUM({<Year=,Month=,Week=,Date = {">=$(=YearStart(Today(),-1))<=$(=AddYears(Today(),-1))"}>}Sales)

Not applicable
Author

Hi Manish

I have to use the expression to make a pie chart, and with your latest reply it doent work?????

MK_QSL
MVP
MVP

Provide sample data or your sample apps.

Not applicable
Author

Sorry Not possible

MK_QSL
MVP
MVP

OK... Best Luck..!