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

Alternative in Script

Hi Folks,

i got a sitaution:

i use this expression to calculate an average of last 12 Month:

sum(aggr(rangesum(above(sum({$<Period,Year,DateType={'Personal'}>}Amount),0,12))Link,Period))/12

it does work, but it takes a bit a time,

How can i implement such expression in script to make speed on the surface (UI) a bit faster.

Thank a lot for any help

Beck

2 Replies
hector_munoz
Specialist
Specialist

Hi Beck,

What you could do is creating a new field with the following formula:

If(DateType = 'Personal', Amount / 12, 0)     AS Amount2

, with this new field you could change your current expression to:

sum(aggr(rangesum(above(sum({$<Period,Year>} Amount2),0,12))Link,Period))

Is not a bit change but, considering user selection implications, I donot think you can improve it more... unless you can group it by Link and Period in another table.

Regards,

H

beck_bakytbek
Master
Master
Author

Hi Hector,

first of all, thanks a lot for you help, i try to implement it and will tell you when i have an expected output

Thanks a lot

Beck