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

Announcements
Now accepting applications for the Qlik Luminary and Partner Ambassador Programs: Apply by July 6!
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

Labels (1)
1 Reply
sunny_talwar
MVP
MVP

Try this

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