Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
motzfeldt01
Partner - Contributor II
Partner - Contributor II

Load* inline for beginners

Hi,


I'm working with a dataset containing a bunch of accounts from various companies. Now I want to make a dimension for the years comming, why I call it 'Future years'. For this reason I'm trying use Load* inline.


This is some of my original dataset:

CompanyIDCompanyNameFiscalYearRevenueCostOfGoodsEquityTaxes
1Carlsberg20181009100000.25
2Heineken2017851090000.20


I want to make a forecast of FY 2019, FY 2020, FY 2021 and so on and it has to be dynamic, that's I use max([FiscalYear]) to find the latest accounting year. I'm using the following Load* inline code, but it's not working well. Any ideas how to fix this?

"Future Development":

Load * Inline [

Year, FutureYears

2019, max([FiscalYear])+1

2020, max([FiscalYear])+2

2021, max([FiscalYear])+3

];

Thanks in advance

1 Solution

Accepted Solutions
giovanneb
Creator II
Creator II

Hi try this,

Table1:

LOAD * Inline [

CompanyID, CompanyName, FiscalYear, Revenue, CostOfGoods, Equity, Taxes

1, Carlsberg, 2018, 100, 9, 10000, 0.25

2, Heineken, 2017, 85, 10, 9000, 0.20

];

tmpMax:

LOAD

max(FiscalYear) as FiscalYear

Resident Table1;

LET vYearMax1 = Peek('FiscalYear', '0', 'tmpMax')+1;

LET vYearMax2 = Peek('FiscalYear', '0', 'tmpMax')+2;

LET vYearMax3 = Peek('FiscalYear', '0', 'tmpMax')+3;

DROP Table tmpMax;

"Future Development":

Load * Inline [

Year, FutureYears

2019, $(vYearMax1)

2020, $(vYearMax2)

2021, $(vYearMax3)

];

Reguards

View solution in original post

2 Replies
giovanneb
Creator II
Creator II

Hi try this,

Table1:

LOAD * Inline [

CompanyID, CompanyName, FiscalYear, Revenue, CostOfGoods, Equity, Taxes

1, Carlsberg, 2018, 100, 9, 10000, 0.25

2, Heineken, 2017, 85, 10, 9000, 0.20

];

tmpMax:

LOAD

max(FiscalYear) as FiscalYear

Resident Table1;

LET vYearMax1 = Peek('FiscalYear', '0', 'tmpMax')+1;

LET vYearMax2 = Peek('FiscalYear', '0', 'tmpMax')+2;

LET vYearMax3 = Peek('FiscalYear', '0', 'tmpMax')+3;

DROP Table tmpMax;

"Future Development":

Load * Inline [

Year, FutureYears

2019, $(vYearMax1)

2020, $(vYearMax2)

2021, $(vYearMax3)

];

Reguards

motzfeldt01
Partner - Contributor II
Partner - Contributor II
Author

It worked, thank you!