Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following expression to calculate
Date is in format YYYYMMDD
Sum({$<Date = {">=$(=vStartDate)<=$(=vEndDate)"}>} Target)
How to calculate the same but for the last year
I try Sum({$<Date = {">=$(=vStartDate)-1<=$(=vEndDate)-1"}>} Target)
but it doesn(t work how to correct it ?
May be this:
Sum({$<Date = {">=$(=Date(AddYears(vStartDate, -1), 'YYYYMMDD'))<=$(=Date(AddYears(vEndDate, -1), 'YYYYMMDD'))"}>} Target)
May be this:
Sum({$<Date = {">=$(=Date(AddYears(vStartDate, -1), 'YYYYMMDD'))<=$(=Date(AddYears(vEndDate, -1), 'YYYYMMDD'))"}>} Target)
Something like this -
Sum({<Year=, Quarter=, Month=, Week=, Date={">=$(=YearStart(Max(Date), -1))<=$(=AddYears(Max(Date), -1))"}>} Sales)
is your date field interpreted as number in qlik if so then you need to do the following:
create two variables vStartLastYear and vEndLasYear
vStartLastYear would be = numDaystart(addYears(date($(vStartDate)),-1))
vEndLastYear would be = numDaystart(addYears(date($(vEndDate)),-1))
in your expression you would use these new variables and you ignore selections on date parts (year=, month=,etc...)