Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
MVP
MVP

Re: Expression help? Compare last year and this year

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

Re: Expression help? Compare last year and this year

Hi Manish

Is it possible to make it into one expression

MVP
MVP

Re: Expression help? Compare last year and this year

='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

Re: Expression help? Compare last year and this year

Hi Manish

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

MVP
MVP

Re: Expression help? Compare last year and this year

Provide sample data or your sample apps.

Not applicable

Re: Expression help? Compare last year and this year

Sorry Not possible

MVP
MVP

Re: Expression help? Compare last year and this year

OK... Best Luck..!