Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
prma7799
Master III
Master III

Month Year field

Hi All,

I have multiple fields like below

SALES UNIT JAN-10SALES UNIT FEB-10SALES UNIT MAR-10SALES UNIT APR-10

I want output like below

Apr-10May-10Jun-10Jul-10
1 Solution

Accepted Solutions
sunny_talwar

Are these field names or values within a field?

If field value then may be this:

Date(Date#(Right(FieldName, 6), 'MMM-YY'), 'MMM-YY')

View solution in original post

15 Replies
sunny_talwar

Are these field names or values within a field?

If field value then may be this:

Date(Date#(Right(FieldName, 6), 'MMM-YY'), 'MMM-YY')

Anonymous
Not applicable

Hi,

You have to options:

1. You can use this:  SubField(<FieldName>,'|',SubStringCount(FieldName,' ')+1

     or

2. You can: RIGHT(<FieldName>, 6)


​It will be more beneficial if this was done in the backend script

prma7799
Master III
Master III
Author

Hi Sunny,

These are fields.

Total fields 69 every month one field get increase .

Now have Jan-10 to Dec-15.

Thanks

sunny_talwar

Are you using CrossTable Load to make them rows instead of keeping them as Column?

prma7799
Master III
Master III
Author

No. I am just fetching data directly.

Yes I will use cross table functionality then use your above solution .

sunny_talwar

May be something along these lines if you are not using CrossTable Load

Table:

LOAD Concat(PurgeChar(@1, '#'), '|', Order) as List;

LOAD @1,

  RecNo() as Order

FROM

Community_200222.xlsx

(ooxml, explicit labels, table is Sheet1, filters(

Transpose()

));

LET vList = Chr(39) & Peek('List') & Chr(39);

DROP Table Table;

FinalTable:

LOAD *

FROM

Community_200222.xlsx

(ooxml, no labels, header is 1 lines, table is Sheet1);

For i = 1 to NoOfFields('FinalTable')

  LET vFieldOld = '[' & FieldName($(i), 'FinalTable') & ']';

  LET vFieldNew = '[' & Date(Date#(Right(SubField($(vList), '|', $(i)), 6), 'MMM-YY'), 'MMM-YY') & ']';

  RENAME Field $(vFieldOld) to $(vFieldNew);

NEXT i;

sunny_talwar

Ya if you use CrossTable you can then change those column using the expression provided earlier

sunny_talwar

Script for CrossTable load

Table:

CrossTable(MonthYear, Data)

LOAD ID,

    [SALES UNIT JAN-10],

    [SALES UNIT FEB-10],

    [SALES UNIT MAR-10],

    [SALES UNIT APR-10],

    [SALES UNIT MAY-10],

    [SALES UNIT JUN-10]

FROM

Community_200222_v1.xlsx

(ooxml, embedded labels, table is Sheet1);

FinalTable:

NoConcatenate

LOAD ID,

  Date(Date#(Right(MonthYear, 6), 'MMM-YY'), 'MMM-YY') as MonthYear,

  Data

Resident Table;

DROP Table Table;


Capture.PNG

prma7799
Master III
Master III
Author

Hi sunindia‌,

I want to implement incremental load here.

Means every month my one month will increase so for that can we use incremental load here?

Thanks