Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Miguel_Angel_Baeyens

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
Author

Query is this :

Set TempSum=0;

Let y= noofrows('Data')

for i=1 to $(y)

if(NoOfPallets <> 0)

TempSum= TempSum+ NoOfPallets;

y++;

SunilChauhan
Champion
Champion

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++;

Sunil Chauhan
Not applicable
Author

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
Champion
Champion

what to correct its look like ok

take TempSum into expression and see the result

if not please be crear what you want.

Sunil Chauhan
Not applicable
Author

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
Champion
Champion

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++;

Sunil Chauhan
Not applicable
Author

Still it is giving error.

" y++ Unknown"

Please find attached of the error file.

SunilChauhan
Champion
Champion

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

Sunil Chauhan