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

hi, community

hi all,

Create a list box which shows last 6 month from till date.

Create a list box to show last six month from a particular selected month.

can  u pls help in this , i have used addmonth function but it is giving me +6 months date from current date in list box, i want to show all six months from current date.

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Use below script...

================

MinMaxDate:

Load

  MakeDate(2011) as MinDate,

  Today() as MaxDate

AutoGenerate 1;

Let vMin = NUM(Peek('MinDate',0,'MinMaxDate'));

Let vMax = NUM(Peek('MaxDate',0,'MinMaxDate'));

Drop Table MinMaxDate;

Calendar:

Load

  Date(TempDate) as Date,

  Month(TempDate) as Month,

  Date(MonthStart(TempDate),'YYYYMM') as MonthYear;

Load

  $(vMin) + IterNo() - 1 as TempDate

Autogenerate 1

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

====================================

Create a list box with below expression

=IF(MonthYear > AddMonths(MonthStart(Today()),-6), Month)

or

=IF(MonthYear > AddMonths(MonthStart(Today()),-6), MonthYear)

View solution in original post

7 Replies
MK_QSL
MVP
MVP

Provide sample data with your requirements... Need to see how your month field is !

Not applicable
Author

Load * inline [

MinDate,Maxdate

01/01/2009,12/15/2011

];

let vMin=Peek('MinDate',0,'Calender1');

let vMax=Peek('Maxdate',0,'Calender1');

Tempcalender:

Load

Date('$(vMin)'+iterno()-1) as tempdate

autogenerate 1 while '$(vMin)'+iterno()<='$(vMax)';

I have created this script and have no sample data for that......and  have this requirement.

Create a list box which shows last 6 month from till date.

Create a list box to show last six month from a particular selected month.

Not applicable
Author

Calendar1:

Load * inline [

MinDate,Maxdate

01/01/2009,12/15/2011

];

let vMin=Peek('MinDate',0,'Calender1');

let vMax=Peek('Maxdate',0,'Calender1');

Tempcalender:

Load

Date('$(vMin)'+iterno()-1) as tempdate

autogenerate 1 while '$(vMin)'+iterno()<='$(vMax)';

MK_QSL
MVP
MVP

Use below script...

================

MinMaxDate:

Load

  MakeDate(2011) as MinDate,

  Today() as MaxDate

AutoGenerate 1;

Let vMin = NUM(Peek('MinDate',0,'MinMaxDate'));

Let vMax = NUM(Peek('MaxDate',0,'MinMaxDate'));

Drop Table MinMaxDate;

Calendar:

Load

  Date(TempDate) as Date,

  Month(TempDate) as Month,

  Date(MonthStart(TempDate),'YYYYMM') as MonthYear;

Load

  $(vMin) + IterNo() - 1 as TempDate

Autogenerate 1

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

====================================

Create a list box with below expression

=IF(MonthYear > AddMonths(MonthStart(Today()),-6), Month)

or

=IF(MonthYear > AddMonths(MonthStart(Today()),-6), MonthYear)

Not applicable
Author

Hi Ankit


Try if this helps Datecolumn > addmonths(Now(),-6)


Thanks

Saumitra

Not applicable
Author

Thanks man , got it @manish

its_anandrjs

There some little change in your load script and try like this way

Calendar1:

Load * inline [

MinDate,Maxdate

01/01/2009,07/09/2014

];

let vMin=Peek('MinDate',0,'Calender1');

let vMax=Peek('Maxdate',0,'Calender1');

DROP Table Calendar1;

Tempcalender:

LOAD

Year(tempdate) as Year,

Month(tempdate) as Month,

tempdate,

tempdate as CalDate;

Load

Date('$(vMin)'+iterno()-1) as tempdate

autogenerate 1

while '$(vMin)' + iterno() -1 <='$(vMax)';

LOAD

CalDate,

IF(tempdate > AddMonths(MonthStart(Today()),-5), Month) as Last6Months

Resident Tempcalender;