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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
noumanbutt
Contributor II
Contributor II

Fiscal Year Syntax Error

I'm using the following code in my script to generate a fiscal year field.

 

LET vFM = 7;
[Fisc]:
DECLARE FIELD DEFINITION Tagged ('$date')
FIELDS

Dual(Right(YearStart($1,0,vFM),2)&'/'&(Right(YearStart($1,0,vFM),2)+1), YearStart($1,0,vFM)) AS [FiscalYear] Tagged ('$axis', '$year'),
Num(Dual('FY'&(Right(YearStart($1,0,vFM),2)+1), YearStart($1,0,vFM))) AS [FY_Num],
;

DERIVE FIELDS FROM FIELDS [TR_DATE] USING [Fisc] ;

 

I use the [FiscalYear] field for plotting and the [FY_NUM] to get max / current year or to sort the data.

However, If I use it to display in a table it works, but it's not working in set analysis nor does it return value if i use it in the KPI chart to test.

My Set Analysis code is following:

 

Count({$<[TR_DATE.Fisc.FY_Num]={"=$(=([TR_DATE.Fisc.FY_Num]))"}>} DISTINCT ID)

I get this message in the bottom which is telling me the FY_Num field is not returning the correct value in number format.

noumanbutt_1-1727410716209.png

Can anyone identify the problem ?

 

Labels (1)
10 Replies
noumanbutt
Contributor II
Contributor II
Author

Much appreciated @Vegar 

 

Thanks to everyone who tried to help.

 

@diegozecchini @Kushal_Chawda @PrashantSangle