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

Mid and Limit in the Load Script

Hi All,

I am bringing in a table with FiscalYearMonth field. it is showing 2 years- 2013 and 2014 and I want to bring in only 2014.

The set up of the field is YYYYMM but I want to split it to just show YYYY as FiscalYear and MM as Month.

I used the mid function on the field in the load scipt

Mid(FiscalYearMonth,1,4) as FiscalYear

Mid(FiscalYearMonth,4,2) as Month

I put where at the end of my from statement (Where FiscalYear=2014) but it did not recognize the field as I am making it in the table. Makes sense. Do you know how to limit my data input to 2014?

3 Replies
Gysbert_Wassenaar

Use this as the where clause:

WHERE Mid(FiscalYearMonth,1,4) = '2014';


talk is cheap, supply exceeds demand
sunny_talwar

You can try like this (in the preceding load):

LOAD *

Where FiscalYear = 2014;

LOAD AllOtherFields,

Mid(FiscalYearMonth,1,4) as FiscalYear

Mid(FiscalYearMonth,4,2) as Month

FROM Source;

swuehl
MVP
MVP

Or maybe

LOAD OtherField,

          FiscalYearMonth,

          Mid(FiscalYearMonth,1,4) as FiscalYear,

          Mid(FiscalYearMonth,5,2) as Month          //shouldn't it be 5,2?

FROM YourTableSource

WHERE FiscalYearMonth LIKE '2016*';