Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasshana
Creator II
Creator II

Set analysis expression to get sum of sales for previous years by eliminating current year

Hi,

do have the below data, my requirement is to write a set analysis expression in a textbox to get sum of sales for all the previous years by eliminating the current year. So the output value which I'm looking is only '7200'.

Sum of sales for all the years is 7800 but sum of sales for previous years by eliminating current year is 7200

DateSales
01-01-2021100
02-02-2021200
03-03-2021300
04-10-2020400
07-09-2020500
24-08-2020600
04-10-2019700
07-09-2019800
24-08-2019900
04-10-20181000
07-09-20181100
24-08-20181200

 

Regards,

Vikas

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

=Sum({<Date-={"=Year(Date)=Year(Today())"}>}Sales)

Or, if you already have a year field

=Sum({<Year-={'$(=Year(Today()))'}>}Sales)

View solution in original post

2 Replies
tresesco
MVP
MVP

Try like:

=Sum({<Date-={"=Year(Date)=Year(Today())"}>}Sales)

Or, if you already have a year field

=Sum({<Year-={'$(=Year(Today()))'}>}Sales)

vikasshana
Creator II
Creator II
Author

Thanks for that, it is working as I expected.