Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor II

Expression Column(1) / Column(2) work but use full expression not work in QS

Hi All

My Column 1 Expression work fine :-


Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"},COUNTRY_={[CASH SALES],'Singapore','EXPORT'}>}sales/Rate)

My Column 2 Expression work fine :-

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"}>}sales/Rate)

I need to compute Ratio of Column(1) and Column(2) as below expression :-


Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"},COUNTRY_={[CASH SALES],'Singapore','EXPORT'}>}sales/Rate)
/
Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"}}>}sales/Rate)

But it return null , can some one advise me.

I cannot make use of Column(1) / Column(2) , because i will be apply the expression in KPI.

Paul

1 Solution

Accepted Solutions

Re: Expression Column(1) / Column(2) work but use full expression not work in QS

There is a small syntax-error within your kpi-expression:

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"},COUNTRY_={[CASH SALES],'Singapore','EXPORT'}>}sales/Rate)

/

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"}}>}sales/Rate)

- Marcus

6 Replies
paulyeo11
Valued Contributor II

Re: Expression Column(1) / Column(2) work but use full expression not work in QS

my qvf

vinieme12
Esteemed Contributor II

Re: Expression Column(1) / Column(2) work but use full expression not work in QS

Hi Paul,

Frankly I do not understand a percentage / percentage kpi

But perhaps the below could be meaningful.

(Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"},COUNTRY_={[CASH SALES],'Singapore','EXPORT'}>}sales)

-

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"}}>}sales))/Rate)

vinieme12
Esteemed Contributor II

Re: Expression Column(1) / Column(2) work but use full expression not work in QS

O you could also refer to the column names instead of referring to them by column number

Digvijay_Singh
Honored Contributor III

Re: Expression Column(1) / Column(2) work but use full expression not work in QS

You got small formatting error in second expression -

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"}}>}sales/Rate)


Remove one bracket and it will work

Re: Expression Column(1) / Column(2) work but use full expression not work in QS

There is a small syntax-error within your kpi-expression:

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"},COUNTRY_={[CASH SALES],'Singapore','EXPORT'}>}sales/Rate)

/

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = >} month))"}}>}sales/Rate)

- Marcus

paulyeo11
Valued Contributor II

Re: Expression Column(1) / Column(2) work but use full expression not work in QS

Hi Vin

I already got the solution from the answer provide by 2 user , as i have accidently insert one more {{

Paul

Community Browser