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

Button to select last 12 months from a selected Month

I'm trying to add a button that will select the last 12 months from my selected Month.  For example  If i select April 2021, i want the button to select   (March 2020...April 2021)   I do have a Master Calendar that loads  see below, just not sure how to put the logic together.  TIA.


MinMax:
Load
Min (INVOICEDATE) AS MinDate,
Max (INVOICEDATE) AS MaxDate
Resident AX_History; //Resident--where the values are coming from

//Page 134-135
Let vMinDate = Peek('MinDate',0, MinMax); //Peak only takes a peak of table
Let vMaxDate = Peek('MaxDate',0, MinMax);
Let vToday = $(vMaxDate);


//Temporary Calendar///

TempCal:
Load
date($(vMinDate) + RowNo()-1) as TempDate ///
AutoGenerate
$(vMaxDate) - $(vMinDate) + 1;

DROP table MinMax;


////***Page 137****///

MasterCalendar:
load
TempDate as INVOICEDATE,
Week(TempDate) as Week,
Year (TempDate) as Year,
Month (TempDate) as Month,
Day (TempDate) as Day,
Weekday(TempDate) as WeekDay,
'Q' & ceil(month(TempDate) /3) as Quarter,
Date(monthstart(TempDate), 'MMM-YYYY') as MonthYear,
Week(TempDate)&'-'&Year(TempDate) AS WeekYear,
InYearToDate(TempDate, $(vToday), 0) * -1 AS CurYTDFlag,
InYearToDate(TempDate, $(vToday),-1) * -1 AS LastYTDFlag
Resident TempCal
ORDER BY TempDate ASC;

Drop Table TempCal;

SET cCurrentYear = Year(today());

 

 

Labels (1)
0 Replies