Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ramu_i
Creator II
Creator II

YTD vs Previous year YTD

Hi All, 

I have date field, sales ... fields are there,

Date format is 'DD-MM-YYYY'  --- In that extract  Year(Date) it show the year value.

I have KPI -  YTD  data is displayed. Opening the dashboard it will display 2021 - Jan -1 to 2021 - Nov -27 data.(YTD)

Variance one KPI is there in that  display the current vs previous year YTD displayed , How much % is increase or decrease.

here problem is 

Today is nov-27 -2021, 

Variance is   (current - Previous )/Previous 

But Current ytd display the Jan to Nov, But previous YTD will display the Jan -  Dec,

let assume that current year is Mar-20-2022, 

If calculating the Variance is  (mar-20-2022-Jan-Dec-2021)/(Jan-Dec-2021)

I want to comapre (Mar-20-2022  -  Mar-20-2021)/Mar-20-2021

Year filter is there, It will display the current year, If filter select the values like 2020 ,it will display the 20 value compare with 19 data.

For Example.

2018---120

2019---90

2020---120   ---- Jan -10, .... Dec-10 like every month value is 10 let saaume

2021---140 (Jan to Nov Data)

 here In filter select the year is 2020  ---- Variance   120-90/90=0.33

Current year variance is  showing  140-120/120=0.16 ---This is wrong

I want to get --- 2020 every month get the values is 10 --- So, Jan to Nov has 110 value

Required Variance is --- 140-110/110=0.27  this is the right value.

 

Please help for this scenario

Thanks Advance

Regards,

Ram 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2 Replies
rubenmarin

Hi, if use max date as reference YTD could be: Sum({<Date={">=$(=Yearstart(Max(Date)))<=$(=Max(Date))"}, Month>} Value)

And last year YTD could be: Sum({<Date={">=$(=Yearstart(Max(Date),-1))<=$(=AddYears(Max(Date),-1))"}, Month,Year>} Value)

 

Ramu_i
Creator II
Creator II
Author

Hi Rubenmarin,

Thanks for your replay,

It's working but main problem is , If select the current year - it will display the KPI is Current year data  and , Varience is current year- Same date of previous year/same date of previous year.

If select the 2020 or 2019 or any year , it will display the current year-previous/ previous year.

if current year it will display the current year - previous year of same date / previous year of same date .

 

But above logic is not working. If select the year it won't display the data.