Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
ajsjoshua
Specialist
Specialist

Lockperiod

Hi all,

I want to calculate the values using lockperiod.

Lockperiod=0,2,3 but i am using this formula

=num(sum({$<Year = {$(=max(Year))},MonthID={$(=Max(MonthID)+Lockperiod)},Quarter=,Month=,Year=>} Arrivals),0.00).

Its not working.

I also tried by using variable but its working working for a specific lockperiod

Vlockperiod=2

=num(sum({$<Year = {$(=max(Year))},MonthID={$(=Max(MonthID)+Vlockperiod)},Quarter=,Month=,Year=>} Arrivals),0.00).

But i want to calculate for all lock period.

Regards,

Joshua.

Labels (1)
4 Replies
marcus_sommer
MVP
MVP

Your +Lockperiod won't add further values to the dataset it will be interpreted as aggregation like a+b. Therefore try something like this:

=num(sum({$<Year = {"$(=max(Year))"},MonthID={"$(=Max(MonthID))", $(VLockperiod)} >} Arrivals),0.00)


This Quarter=,Month=,Year= is removed then it made no sense in a expression which determined excactly which periods should be calculated. Further I'm not sure if not something like this is enough if you have a unique MonthID for each monthly period:


=num(sum({$< MonthID={$(VLockperiod)} >} Arrivals),0.00)

- Marcus

ajsjoshua
Specialist
Specialist
Author

hi Marcus,

Thanks for ur reply in variable wat u declare,

VLockperiod=0,2,3 lik that.

Regards,

Joshua.

marcus_sommer
MVP
MVP

Try if you get with manually entries your expected result: num(sum({$< MonthID={0,2,3} >} Arrivals),0.00). If yes go further and use a table-chart without a label for the expression with a variable which contained these 0,2,3 - within the label you could see how qlikview interpreted all parts of your expression.


- Marcus

ajsjoshua
Specialist
Specialist
Author

Hi Marcus,

Thanks for ur Reply.

Happy New Year wish u a great year ahead.

Regards,

JOSHUA