Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to add a calculated field in load script or table box?

Hi there,

I am a beginner.

i want to adds a calculated field 'FY' base on original field 'month' in load script or table box.

the logic is ' if month is November or December, then FY is 'next year', else 'current year.'

thank you in advance!

3 Replies
anbu1984
Master III
Master III

In Script,

Load Month, If(Wildmatch(Month,'November','December'),Year(Today())+1,Year(Today())) As FY

From Table;

If you have year field, then replace Year() by year field in above script

sagarkharpude
Creator III
Creator III

if(month='November' or month='December',$(vnextyear),$(currentyear)) as FY

Create the variable as vnextyear=year(today()+1)

currentyear=year(today())

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this in script

LOAD

*,

If(MixMatch(month, 'November', 'December'), Year(DateFieldName) + 1, Year(DateFieldName))  AS  FY

FROM DataSource;

Hope this helps you.

Regards,

Jagan.