Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
soha1902
Creator
Creator

Year on Year comparision

Hi All,

I have two Fiscal Year of Data. lease see following images:

2.png

1.png

I want to implement the Year on Year comparison in single chart.

For Example if user select 2014-2015 then previous will be 2013-2014. My fiscal year start from July  to June like its coming in chart.

Thanks.

1 Solution

Accepted Solutions
jsingh71
Partner - Specialist
Partner - Specialist

Follow This:

Create two variables

vCurrent = left(FiscalYear,4)&'-'&(left(FiscalYear,4)+1)

vPrevious =  Left(FiscalYear,4)-1&'-'&Left(FiscalYear,4)

Now In Chart Selection FiscalMonth Dimension as you are using the same and write following two expressions:

Current Year: Sum({<FiscalYear={'$(vCurrent)'}>} <Your Field>)

Previous: Sum({<FiscalYear={'$(vPrevious)'}>} <Your Field>)

Hope This will work.

JS

View solution in original post

9 Replies
senpradip007
Specialist III
Specialist III

Try to use these expressions;

For Current Year: Sum({<FiscalYear={$(=Max(FiscalYear))}>} DataField)

For Previous Year: Sum({<FiscalYear={$(=Max(FiscalYear)-1)}>} DataField)

soha1902
Creator
Creator
Author

Hi Pradip,

I can not use Max(FiscalYear)-1 directly..see Fiscal year format.

senpradip007
Specialist III
Specialist III

Can you upload some sample data with expected output?

soha1902
Creator
Creator
Author

3.png

See the image its is showing the selected year...I want to add one more line in the same chart for previous Year.

Sample file is attached. But please share the script as I am using Personal Edition.

soha1902
Creator
Creator
Author

Any Suggestions Plz.

senpradip007
Specialist III
Specialist III

PFA. Hope it will help.

kavita25
Partner - Specialist
Partner - Specialist

jsingh71
Partner - Specialist
Partner - Specialist

Follow This:

Create two variables

vCurrent = left(FiscalYear,4)&'-'&(left(FiscalYear,4)+1)

vPrevious =  Left(FiscalYear,4)-1&'-'&Left(FiscalYear,4)

Now In Chart Selection FiscalMonth Dimension as you are using the same and write following two expressions:

Current Year: Sum({<FiscalYear={'$(vCurrent)'}>} <Your Field>)

Previous: Sum({<FiscalYear={'$(vPrevious)'}>} <Your Field>)

Hope This will work.

JS

Not applicable

Alternatively you could use 2 lists boxes corresponding to different alternate states and then call

State A from expression 1

State B from expression 2

this way you could compare any 2 years and aren't locked in year and year -1