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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
nickedw0
Creator
Creator

Use current/Prior year in Set Analysis

When I use the following in a text box the result displayed is 2017 (or 2018, depending on AsOfDate) :

=If(Year(AddMonths(AsOfDate,-1))=Year(AddMonths(AsOfDate,0)),Year(AddMonths(AsOfDate,0)),Year(AddMonths(AsOfDate,-1)))

I need to use this in a set analysis statement, though. I tried the following without success:

=Count( { <Month=,Year-{"=If(Year(AddMonths(AsOfDate,-1))=Year(AddMonths(AsOfDate,0)),Year(AddMonths(AsOfDate,0)),Year(AddMonths(AsOfDate,-1)))"} >} Products)

TIA

1 Reply
sunny_talwar

Try this

=Count({<Month,Year = {"$(=If(Year(AddMonths(AsOfDate, -1)) = Year(AddMonths(AsOfDate, 0)), Year(AddMonths(AsOfDate, 0)), Year(AddMonths(AsOfDate, -1))))"}>} Products)