Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Veerendra_Katikala
Contributor III
Contributor III

show data for previous year until end of Q1 and from Q2 show current year

Hi Experts,

I have one requirement to 'show data for previous year until end of Q1 and from Q2 show current year' when open an app by default.

Lets say if we are in current year and current quarter (any Month Jan/Feb/Mar in Q1), by default app should open with previous year selection until Q1 ends then if we are enter into Q2 the year should select with current year.

I already have one bookmark (pic below) which shows current year and months (as of today) by default when open an app but need to implement the above requirement. 

Veerendra_Katikala_0-1723139096737.png

 

could you please help me with the ways to implement?

 

1 Solution

Accepted Solutions
Veerendra_Katikala
Contributor III
Contributor III
Author

I use following approach to achieve the solution

 

//Step1: Define Variable for Current Year and Quarter

let vToday = Today();
let vCurrentYear = Year(Today());
let vCurrentMonth = Month(Today());
let vCurrentQuarter = Ceil(vCurrentMonth/3);

//Step 2: Determine the Year based on Current Quarter

If vCurrentQuarter = 1 then
let vYear = vCurrentYear - 1;
Else
let vYear = vCurrentYear ;
End If;

 

Then, I applied this variable in the Year filter in the app.

 

1. Click on the 'Year' filter

2. in the search box , type =Year=$(vYear) and press enter , this will filter the data to the previous year if the current quarter is 1

View solution in original post

1 Reply
Veerendra_Katikala
Contributor III
Contributor III
Author

I use following approach to achieve the solution

 

//Step1: Define Variable for Current Year and Quarter

let vToday = Today();
let vCurrentYear = Year(Today());
let vCurrentMonth = Month(Today());
let vCurrentQuarter = Ceil(vCurrentMonth/3);

//Step 2: Determine the Year based on Current Quarter

If vCurrentQuarter = 1 then
let vYear = vCurrentYear - 1;
Else
let vYear = vCurrentYear ;
End If;

 

Then, I applied this variable in the Year filter in the app.

 

1. Click on the 'Year' filter

2. in the search box , type =Year=$(vYear) and press enter , this will filter the data to the previous year if the current quarter is 1