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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
gautik92
Specialist III
Specialist III

Selection of dates in set analysis

I Have a calendar object in that if i select any dates it should give previous year same dates

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Try like,

=Sum({$<Date={">=$(=AddMonths(Min(Date),-12))<=$(=AddMonths(Max(Date),-12))"}>}Amount)

View solution in original post

11 Replies
hemachandran
Partner - Creator
Partner - Creator

try the code like given below as per your need...

=Sum({$<Year=P({<Year={$(=max(Year)-1)}>}Year),month=P({<Year={$(=max(Year)-1)}>} month>} TotalPrice)

avinashelite

Try like this

sum({<Date = {$(=AddYears(Date,-1))}>} Sale)

ashishkalia
Partner - Creator
Partner - Creator

Hi Gowtham,

As Avinash R mentioned an expression,

Take it in a variable and u'll get the last year same date. some modification

i.e. vVariable = date(AddYears(max(Date), -1),'MM/DD/YYYY')

or

     vVariable = date(AddMonths(max(Date), -12),'MM/DD/YYYY')

use variable any where

Kushal_Chawda

try this

sum({<Date = {"$(=addyears(max(Date),-1))"}, Date=>} Sale)

settu_periasamy
Master III
Master III

Another option.. setdateyear ‒ QlikView

Capture.JPG

gautik92
Specialist III
Specialist III
Author

working for single date but i need for multiple dates

tamilarasu
Champion
Champion

Try like,

=Sum({$<Date={">=$(=AddMonths(Min(Date),-12))<=$(=AddMonths(Max(Date),-12))"}>}Amount)

gautik92
Specialist III
Specialist III
Author

not working bro

Kushal_Chawda

I think you are looking for this?

=Sum({$<Date={">=$(=yearstart(addyears(Max(Date),-1)))<=$(=addyears(Max(Date),-1))"}, Date=>}Amount)