Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
krishnakv83
Contributor II
Contributor II

Previous year

I have  text box expression which is  working with current year.i'm trying to calculate previous year value in the text box but value is  zero.

Used below formula for previous year.

{<[Year]={$(=Max([Year])-1)>}

Is there any method to calculate previous year other than above method.If yes , please provide your view to calculate previous year.

This is to be resolved today.Pls help

Regards,

Venkat

20 Replies
krishnakv83
Contributor II
Contributor II
Author

I tried below code.As field selection is null the vlaue in the expression is zero.

=If(GetFieldSelections(Year)>0,num(avg({<[Year]={'$(=Max(Year)-1)'}>}  aggr(

if('$(vPerformance)'='Delivery',

if($(vAcceptableDaysDelayed) >= fabs( avg({<[Year]={$(=Max(Year)-1)'}>}  aggr( $(eDOT_DiffDel) , $(eAggrLevel1) )) ) ,1,0)

, ),[Purchasedoc], [Purchaseposition]))*100    ,'#.##0,00'),

Anil_Babu_Samineni

Because, there is no condition for non-selected one.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
krishnakv83
Contributor II
Contributor II
Author

Can we write a code like if the get field selection is null the default consider year is max (year).hence based on year the below expression should work.Because I can not always select one value for year.

Is it possible to define ?

Anil_Babu_Samineni

Off course, Why Not?

Red part is for selection, If you select 1 and more it will show Max year data that is green part else blue, It will show all values which are selections

=If(GetFieldSelections(Year)>0,num(avg({<[Year]={'$(=Max(Year))'}>}  aggr(

if('$(vPerformance)'='Delivery',

if($(vAcceptableDaysDelayed) >= fabs( avg({<[Year]={$(=Max(Year))'}>}  aggr( $(eDOT_DiffDel) , $(eAggrLevel1) )) ) ,1,0)

, ),[Purchasedoc], [Purchaseposition]))*100    ,'#.##0,00'),

num(avg(aggr(

if('$(vPerformance)'='Delivery',

if($(vAcceptableDaysDelayed) >= fabs( avg(aggr( $(eDOT_DiffDel) , $(eAggrLevel1) )) ) ,1,0), ),[Purchasedoc], [Purchaseposition]))*100    ,'#.##0,00'))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
krishnakv83
Contributor II
Contributor II
Author

Yes your code is working for me.Thank you

But I'm little skeptical to use this big code in the front end.Because I need to use this formula $(vPerformance)'='Delivery', in 9 places 1 st tab and $(vPerformance)'='confirmation', 9 places in 2nd tab.

I guess this calculation is burden in the front end and leads to performance issue in future.

Regards,

Venkat

Anil_Babu_Samineni

I don't think so, It won't kill the performance. Are you getting anything related performance problem?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
krishnakv83
Contributor II
Contributor II
Author

This report has 6 tabs and mulyi langa.. dashboard.Supporting 4 countries.few charts are taking time to load.

I'm thing on the solution.

Regards,

Venkat

Anil_Babu_Samineni

Sure, Instead Front end, create one Master Parameter table for multi languages supporting to USERS. That makes sense to keep update upon stage..

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
krishnakv83
Contributor II
Contributor II
Author

I don'know I'm using solution and creating the report.We will see if face any performance issue.

As of now Providing the solution  is more important

Regards,

Venkat

Anil_Babu_Samineni

Great, Now you can do your job !!!

Qlik Community Tip: Marking Replies as Correct or Helpful

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful