Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
abc_18
Creator II
Creator II

How to calculate previous year data

HI ,

My expression is

if(DIVISION='PUMA',sum({<FYEAR=>})Value,sum({<Year=>})Value)

if I select Year=2015 then its coming correct, how to get previous year data ie; 2014

Please suggest.

5 Replies
Gysbert_Wassenaar

Maybe like this:

if(DIVISION='PUMA',sum({<FYEAR={$(=only(FYEAR)-1)}>})Value,sum({<Year={$(=only(Year)-1)}>}>})Value)


If not, please post a small qlikview document that demonstrates the problem.


talk is cheap, supply exceeds demand
sunny_talwar

Are you using this in a chart where you have Year or Date as dimension? If yes, then you might need to use Above()/Below() functions to get this to work.

abc_18
Creator II
Creator II
Author

Hi Sunny,

Yes I am using this in a chart (Straight Table), and Date is a dimension.

Date I have linked with master calendar .

sunny_talwar

You will need to use Above()/Below() function to get it to work. Do you have a sample that you can share?

abc_18
Creator II
Creator II
Author

Hi,

In Master calendar I have two year field one for fiscal year and other for calendar year.(Fyear(Oct-Sep),Year(Jan-Dec))

I need to calculate FY'15, FY 16 Actuals value.(Two Calculated field).so for Intel division we need to use calendar year(Year) and for others division need to use Mater calendar(Fyear).

Likethis:-

if(Division='Intel',sum(value)based on Calendar year,otherwise sum(value) based on fiscal year).

Please  help me out in this..sample file is attached.