Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
pinky1234
Contributor III
Contributor III

I need help to get last quarter data dynamically

Hi,

My Qlik report is a quarterly report and this report will get refreshed every quarter. When i am loading the data from database , I want to pull last quarter data dynamically in load script itself. For ex: We are currently in Last quarter of 2022 , Now I want to pull the last quarter data which is 2021-07-01(July) to 2021-09-30(Sep) . Next when Qlik report get refreshed on Jan01 2022 then Dynamically it should pull last quarter data which is from Oct 01-2021 to Dec 31 -2021 data. Can some one help me how to achieve this in load script. Thanks!

1 Reply
Or
MVP
MVP

Let vStartDate = QuarterStart(AddMonths(Today(),-3));

Let vEndDate = QuarterEnd(AddMonths(Today(),-3);

Load *;

Select *

From YourTable

Where YourDate BETWEEN ('$(vStartDate)' and '$(vEndDate)')

Note that you may need to play around with the exact syntax and date formatting to get this to work correctly, but that's the gist of it.