Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
andreyfcdk91
New Contributor III

TwoMonth period cross

Colleagues, good day!

Is in QV any solution to make field with two moth periods, in which every month includes two periods?

I need to make field (by date field) with such values:

Jan-Feb

Feb-Mar

Mar-Apr

Apr-May

May-Jun

Jun-Jul

Jul-Aug

Aug-Sep

Sep-Oct

Oct-Dec

Dec-Jan

Many thanks for every advice!

Andrey.

9 Replies
MVP
MVP

Re: TwoMonth period cross

Have you got date field?

Create something like below..

Dual(Month(Date) & '-' & Month(AddMonths(Date,1)) ,Month(Date)) as YourDualMonthField

Re: TwoMonth period cross

Is this This Month - Next Month or Last Month - This Month?

andreyfcdk91
New Contributor III

Re: TwoMonth period cross

Yes. I have date field.

Field YourDualMonthField , example (Jan-Feb) get only January dates, but i need Jan & Feb dates

Thanks.

andreyfcdk91
New Contributor III

Re: TwoMonth period cross

yes

Re: TwoMonth period cross

Which one of the two?

ThisMonth - NextMonth

or

LastMonth - NextMonth?

andreyfcdk91
New Contributor III

Re: TwoMonth period cross

It must be not flag, but field with two month period names.

For example, today date (09.02.2016) must include Jan-Feb and Feb-Mar.

MVP
MVP

Re: TwoMonth period cross

Something like below?

Data:

Load * Inline

[

  Date, Sales

  10/01/2016, 100

  25/02/2016, 120

  12/03/2016, 90

];

DualMonth:

Load Distinct Date, Month(Date) & '-' &Month(AddMonths(Date,1)) as Flag Resident Data;

Concatenate

Load Distinct Date, Month(AddMonths(Date,-1)) & '-' &Month(Date) as Flag Resident Data;

andreyfcdk91
New Contributor III

Re: TwoMonth period cross

It doesn't work.

MVP
MVP

Re: TwoMonth period cross

Your dates are text values, not proper date values. Convert them to proper numeric date values and then Manish's logic will work.

When you load the dates, you need something like:

     LOAD

          ...

          Date#(Date, 'dd/MM/yyyy') As Date,

          ...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Community Browser