Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

paulyeo11
Valued Contributor II

SET expression after add month*30 chart 2 not working correctly ?

Hi All

I have SET expression for Table 1 is show correctly:-

=(Avg({$<year = {$(=max(year))}, month = {"$(=max({<year={$(=max(year))}>} month))"}>} (STK_OPEN+STK_CLOSE)/2)/1000)

I have SET expression for chart 1 is show correctly:-

=(Avg({$<year = {$(=max(year))}, month = {"<=$(=max({<year={$(=max(year))}>} month))"}>} (STK_OPEN+STK_CLOSE)/2)/1000)

I have SET expression for Table 2 is show correctly:-

=(month+30*Avg({$<year = {$(=max(year))}, month = {"$(=max({<year={$(=max(year))}>} month))"}>} (STK_OPEN+STK_CLOSE)/2)/1000)

I have SET expression for chart 2 is show not correctly result :-

=(month*30*Avg({$<year = {$(=max(year))}, month = {"<=$(=max({<year={$(=max(year))}>} month))"}>} (STK_OPEN+STK_CLOSE)/2)/1000)

May i know how to modify chart 2 expression , so that it can show correct result as table 2 ?

How to check ?

Step 1 click on step 1 button , you should note that Table 1 and Chart 1 and table 2 display correct value , and chart 2 show wrong value. because chart 2 dec should 593,000.9 is wrong , it should be show 49,428.7

Step 2 click on step 2 button , you should note that Table 1 and Chart 1 and table 2 display correct value , and chart 2 show wrong value. because chart 2 dec should 130,269.3 is wrong , it should be show 43,426.1

Paul

10 Replies
pokassov
Valued Contributor

Re: SET expression after add month*30 chart 2 not working correctly ?

Hi!

I looked into your expressions:

=(month*30*Avg({$<year = {$(=max(year))}, month = {"<=$(=max({<year={$(=max(year))}>} month))"}>} (STK_OPEN+STK_CLOSE)/2)/1000)

=(month+30*Avg({$<year = {$(=max(year))}, month = {"$(=max({<year={$(=max(year))}>} month))"}>} (STK_OPEN+STK_CLOSE)/2)/1000)

Is it correct?

paulyeo11
Valued Contributor II

Re: SET expression after add month*30 chart 2 not working correctly ?

Hi Sir

Yes it correct when i click on step 2 , but when click on step 1 , i need it display in line chart , to display the trend line, it does not appear.

Paul

pokassov
Valued Contributor

Re: SET expression after add month*30 chart 2 not working correctly ?

I have no idea why you expected the same value if you had multiplied the same expression by month. 3 and 12 for your steps.

Sergey

Not applicable

Re: SET expression after add month*30 chart 2 not working correctly ?

Hi..

try once

=(month+"30*",Avg({$<year = {$(=max(year))}, month = {"$(=max({<year={$(=max(year))}>} month))"}>} (STK_OPEN+STK_CLOSE)/2)/1000)

paulyeo11
Valued Contributor II

Re: SET expression after add month*30 chart 2 not working correctly ?

Hi Cep 

My table 2 give me correct result. When I click on step button . And I try to make my table 2 display in chart. 

Hope you understand now.

Paul

Sent from Samsung Mobile

paulyeo11
Valued Contributor II

Re: SET expression after add month*30 chart 2 not working correctly ?

Hi Screen

Thank you for your code. I try it got syntax error. It is possible give the file if you solve my problem. 

Paul

Sent from Samsung Mobile

pokassov
Valued Contributor

Re: SET expression after add month*30 chart 2 not working correctly ?

In table 2 you do this " month+ "

instead of chart 2, where you do this " month* "

paulyeo11
Valued Contributor II

Re: SET expression after add month*30 chart 2 not working correctly ?

Hi Cep 

Only chart 2 have problem. The rest of the table and chart are okay.

May I know why you ask me modify Table 2 expression ?

Paul

Sent from Samsung Mobile

pokassov
Valued Contributor

Re: SET expression after add month*30 chart 2 not working correctly ?

No. I ask  you change chart 2 expression. from month* to month+