Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Secu
Contributor
Contributor

MasterCalendar with Start and Enddate

Hello everyone,

I'm new to QlikView and I have a problem getting the MasterCalendar in my application to work and I hope you can help me out.

My data consists of a StartDate and an EndDate and my goal is to be able to select a Year and select all of the data which includes the selected year between StartDate and EndDate.

Since I have two different Dates I have trouble properly getting the calendar to work.

 

Any guidance is much appreciated,

Patrick

Labels (1)
2 Replies
Digvijay_Singh

May be this below script can help with some modifications as per your needs 

LET vMin = Num(MakeDate(2020));

LET vMax = Num(MakeDate(2023));

Master Calendar:
LOAD

Date(floor(MonthEnd($(vMin),IterNo()-1)),'MMM-YY') as [Month Year]

AutoGenerate 1

While MonthStart($(vMin),IterNo()-1) <= $(vMax);

OR take help from this post - 

https://community.qlik.com/t5/QlikView-App-Dev/How-to-create-calender-with-start-date-and-end-date-w...

 

Thanks,

 

Chanty4u
MVP
MVP

// Step 1: Load the data

MyData:

LOAD *,

    Year(StartDate) as StartYear,

    Year(EndDate) as EndYear

FROM MyDataSource;

 

// Step 2: Set the variables for the selected year

LET vSelectedYear = 2022; // Change this to the selected year

 

// Step 3: Filter the data based on the selected year

FilteredData:

LOAD *

RESIDENT MyData

WHERE StartYear <= vSelectedYear AND EndYear >= vSelectedYear;

 

// Step 4: Drop the unnecessary fields

DROP FIELDS StartYear, EndYear;