Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

For loop Problem

Hi

PFA

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Please find script below

FOR i = 1 to Month(Today()) -1

  LET vMonthYear = Text(Date(MakeDate(Year(Today()), i), 'MMM YYYY'));

  If i = 1 then

  Data:

  LOAD organizationLookupDesc,

      corporateFunctionLookupDesc,

      employeeRootId,

      lastName,

      firstName,

      '$(vMonthYear)' AS SheetName    

  FROM

  [EMEA HEADCOUNT 2014_GMBH-Anonym.xlsx]

  (ooxml, embedded labels, table is '$(vMonthYear)');

  ELSE

  Concatenate(Data)

  LOAD organizationLookupDesc,

      corporateFunctionLookupDesc,

      employeeRootId,

      lastName,

      firstName,

      '$(vMonthYear)' AS SheetName      

  FROM

  [EMEA HEADCOUNT 2014_GMBH-Anonym.xlsx]

  (ooxml, embedded labels, table is '$(vMonthYear)');

  ENDIF

NEXT

Regards,

Jagan.

View solution in original post

1 Reply
jagan
Luminary Alumni
Luminary Alumni

Hi,

Please find script below

FOR i = 1 to Month(Today()) -1

  LET vMonthYear = Text(Date(MakeDate(Year(Today()), i), 'MMM YYYY'));

  If i = 1 then

  Data:

  LOAD organizationLookupDesc,

      corporateFunctionLookupDesc,

      employeeRootId,

      lastName,

      firstName,

      '$(vMonthYear)' AS SheetName    

  FROM

  [EMEA HEADCOUNT 2014_GMBH-Anonym.xlsx]

  (ooxml, embedded labels, table is '$(vMonthYear)');

  ELSE

  Concatenate(Data)

  LOAD organizationLookupDesc,

      corporateFunctionLookupDesc,

      employeeRootId,

      lastName,

      firstName,

      '$(vMonthYear)' AS SheetName      

  FROM

  [EMEA HEADCOUNT 2014_GMBH-Anonym.xlsx]

  (ooxml, embedded labels, table is '$(vMonthYear)');

  ENDIF

NEXT

Regards,

Jagan.