Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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.

Not applicable

Expression

Hi All,

Please Suggest how to write this in expression

Set TempSum=0;

Set RowCount= 162522;

for(RowCount<= 162522)

  if(NoOfPallets <> 0)

  TempSum= TempSum+ Pallets;

RowCount++;

Thanks.

21 Replies

Expression

Hi Sandeepa,

Is that an expression in a chart? Or a loop in the script? Can you please elaborate on your requirements and expected returns?

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Not applicable

Re: Expression

Query is this :

Set TempSum=0;

Let y= noofrows('Data')

for i=1 to $(y)

if(NoOfPallets <> 0)

TempSum= TempSum+ NoOfPallets;

y++;

SunilChauhan
Esteemed Contributor

Expression

hope this

Set TempSum=0;

Let y= noofrows('Data')

for i=1 to $(y)

if(NoOfPallets <> 0)

load

TempSum+ NoOfPallets as TempSum

autogenrate 1;

y++;

Not applicable

Re: Expression

Please Correct it:

Data:

LOAD  CustNo,

          ItemCode,

          OrderNo,

           OrderQty,

     DeliveredQty,

    InvoiceDate,

     Month([Invoice Date]) as Month,

    'Q' & ceil(month([Invoice Date]) / 3)    AS Quarter,

    InvoiceNo,

     InvoiceAmount,

     Pallet,

     Carton,

     Shrink,

     [No Of Pallets] as NoOfPallets,

     [No Of Cartons] as NoOfCartons,

     [No Of Shrinks] as NoOfShrinks,

     Loose

FROM

(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);

Let y= noofrows('Data');

Join(Data)

Load

for i=1 to $(y)

if(NoOfPallets <> 0, TempSum+ NoOfPallets) as TempSum,

autogenerate 1;

y++;

SunilChauhan
Esteemed Contributor

Expression

what to correct its look like ok

take TempSum into expression and see the result

if not please be crear what you want.

Not applicable

Re: Expression

Let y= noofrows('Data');

Join(Data)

Load

for i=1 to $(y)

if(NoOfPallets <> 0, TempSum+ NoOfPallets) as TempSum,

autogenerate 1;

y++;

It's giving syntax error.

SunilChauhan
Esteemed Contributor

Expression

use this

Let y= noofrows('Data');

Join(Data)

Load

for i=1 to $(y)

if(NoOfPallets <> 0, TempSum+ NoOfPallets) as TempSum// here comma is not required

autogenerate 1;

y++;

Not applicable

Re: Expression

Still it is giving error.

" y++ Unknown"

Please find attached of the error file.

SunilChauhan
Esteemed Contributor

Expression

i believe no need to join because there is no key fieeld

use the below code

Let y= noofrows('Data');

Load

for i=1 to $(y)

if(NoOfPallets <> 0, TempSum+ NoOfPallets) as TempSum// here comma is not required

autogenerate 1;

y++;

hope this help