
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set Analysis for 1 year less than today & 2 years greater than today
Hi guys,
I'm trying to move this calculation to Set-Analysis in Qlik Sense when doing a count of sales. Can anyone help me with this?
Count(sales) for year:
=If(
[Quarter Year]>=yearstart(addyears(today(),-1))
and [Quarter Year]<=yearend(AddYears(today(),+2))
,[Quarter Year]
,null())
Considering today (2020), I'd like to display the count of sales for years- 2019, 2020, 2021 & 2022
Next year (2021), it should dynamically change to 2020, 2021,2022,2023
Thank you so much!
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@SkitzN27 like ?
Count({$<[Quarter Year]={">=$(=date(yearstart(addyears(today(),-1))))<=$(=date(yearend(AddYears(today(),+2))))"}>} sales)
Taoufiq ZARRA
"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "
(you can mark up to 3 "solutions") 😉

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@SkitzN27 like ?
Count({$<[Quarter Year]={">=$(=date(yearstart(addyears(today(),-1))))<=$(=date(yearend(AddYears(today(),+2))))"}>} sales)
Taoufiq ZARRA
"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "
(you can mark up to 3 "solutions") 😉

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Taoufiq_Zarra Thank you so much, that definitely guided me to the right direction.
Although, I just had to add the date format:
Sum({$<QTR_Year={">=$(=Date(YearStart(AddYears(today(),-1)),'YYYY'))<=$(=date(yearend(AddYears(today(),+2)),'YYYY'))"}>} Sales)
