# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
Valued Contributor II

## How to make my average stock amount display correctly ?

Hi All

When i select year = 2015 ,

How to make the average stock equal to  1,697 K ? Now it display 1,132 K when i set expression as average.

Kindly see my enclosed QV Doc.

Paul

1 Solution

Accepted Solutions
MVP

## Re: How to make my average stock amount display correctly ?

You don't have any values for 15 March, so whatever you are getting is the right result but if you still want forcefully 1697, change your expressions as below

STOCK_OPEN

IF(sum({\$<year = {\$(=max(year))}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>} STK_OPEN/1000)>0,

sum({\$<year = {\$(=max(year))}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>} STK_OPEN/1000))

STOCK_CLOSE

IF(sum({\$<year = {\$(=max(year))}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>} STK_CLOSE/1000) > 0,

sum({\$<year = {\$(=max(year))}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>} STK_CLOSE/1000))

2 Replies
MVP

## Re: How to make my average stock amount display correctly ?

You don't have any values for 15 March, so whatever you are getting is the right result but if you still want forcefully 1697, change your expressions as below

STOCK_OPEN

IF(sum({\$<year = {\$(=max(year))}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>} STK_OPEN/1000)>0,

sum({\$<year = {\$(=max(year))}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>} STK_OPEN/1000))

STOCK_CLOSE

IF(sum({\$<year = {\$(=max(year))}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>} STK_CLOSE/1000) > 0,

sum({\$<year = {\$(=max(year))}, month = {"<=\$(=max({<year={\$(=max(year))}>} month))"}>} STK_CLOSE/1000))

Valued Contributor II

## Re: How to make my average stock amount display correctly ?

Hi Sir

Thank you very much for your expression.

Paul