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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

caculate values for the previous year for the same period

I am comparing  values between this year and the last year for the same period

this year =num(Sum({1< DateTest={'>=$(=YearStart(Today()))<=$(=Today())'}>}[Prix de vente TTC] ),'# ##0 ;-# ##0 ')

But previous year doesnr' work it returns wrong values

num(Sum({1< DateTest={">=$(=MonthStart(today(),-24))<$(=MonthEnd(today(),-13))"}>} [Prix de vente TTC] ),'# ##0 ;-# ##0 ')

How to modify it ?

1 Solution

Accepted Solutions
maxgro
MVP
MVP

I suggest to add some flag in the calendar; if you want to stay with your expression maybe

num(

Sum({1< DateTest={'>=$(=( AddYears(YearStart(Today()),-1) )),<=$(=AddYears(Today(),-1))'}>} [Prix de vente TTC])

,'# ##0 ;-# ##0 '  )

View solution in original post

2 Replies
Anonymous
Not applicable
Author

maxgro
MVP
MVP

I suggest to add some flag in the calendar; if you want to stay with your expression maybe

num(

Sum({1< DateTest={'>=$(=( AddYears(YearStart(Today()),-1) )),<=$(=AddYears(Today(),-1))'}>} [Prix de vente TTC])

,'# ##0 ;-# ##0 '  )