Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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 -
Thanks,
// 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;