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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set Analysis problem

Hi,

I have come across a small problem.  I have a set of data and am attempting to display the data for the previous year-to-date. 

I have only one filterable data set (YEAR).

The problem I am having is with the actual commencement date.

To explain further.  I use set analysis to set the filterable data set year to YEAR-1 (no problem I can see the entire previous year's data).

When I try to view YTD I get no values. 

To bypass this I can use an IF statement to search for positive values for each commencement period this year and relate this back to the previous year's commencement dates.  This works as long as there is a positive value in the current year's date period.  This is not always the case though.  When the current period is zero I still want to see the previous YTD period.

Sample script as follows:

 

COUNT ({$<YEAR={$(=YEAR-1)}>}DISTINCT(IF(TERM_START<=vPERIOD, ENROLLED)))

Where variable vPERIOD  = Current date period (dd/mm)  + YEAR-1

Any advice would be greatly appreciated.

Thanks

Karl

   

1 Reply
Not applicable
Author

Hi,

Use this Expression.......

vPERIOD=Addyear(Max(TERM_START),-1)

Count({<YEAR={$(#=Max(YEAR)-1)}>}DISTINCT(IF(TERM_START <=vPERIOD,ENROLLED)))