Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
bnelson111
Contributor

Dividing Figures on Script Loads and Multiply

I have recently been doing working on calculations on load script the following works :

((( (((t0."estp-blank-l"*t0."estp-blank-w")/1000000)*t1."estrc-coverage")*(t3.OrderedQty+2500))*t1."estrc-usage")/100000) as "Calculated Ink Kg"

However a simple divide by as below doesn't?

((t1."estrc-cost")/(t1."estrc-weight-qty")) as unit,

But same statement will multiply?

((t1."estrc-cost")*(t1."estrc-weight-qty")) as unit,

Thanks Brett

1 Solution

Accepted Solutions

Re: Dividing Figures on Script Loads and Multiply

In your other question (Table Links and Sums in Scripts, Create new field.) you have this expression inside a SQL SELECT. Maybe this is the problem? Any calculation inside a SELECT statement is executed by the ODBC driver and not by QlikView, and there could be limitations e.g. integers that cannot be divided to form new non-integer numbers.

Try a Preceding Load instead:

Load *,

     "estrc-cost"/"estrc-weight-qty" as unit

     ;

SQL SELECT ... FROM ... ;

HIC

View solution in original post

3 Replies

Re: Dividing Figures on Script Loads and Multiply

Do you have a sample which can show this issue?

MVP & Luminary
MVP & Luminary

Re: Dividing Figures on Script Loads and Multiply

As far as I know that's only possible if t1."estrc-cost is 0 or t1."estrc-weight-qty" is 1.


talk is cheap, supply exceeds demand

Re: Dividing Figures on Script Loads and Multiply

In your other question (Table Links and Sums in Scripts, Create new field.) you have this expression inside a SQL SELECT. Maybe this is the problem? Any calculation inside a SELECT statement is executed by the ODBC driver and not by QlikView, and there could be limitations e.g. integers that cannot be divided to form new non-integer numbers.

Try a Preceding Load instead:

Load *,

     "estrc-cost"/"estrc-weight-qty" as unit

     ;

SQL SELECT ... FROM ... ;

HIC

View solution in original post