Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everyone,
I am writing the following expression in the script
Load A,
B,
C,
Amount,
if(Sum[Amount] = 0, null(), Sum([Amount]),
D,
E,
F
FROM
ABC.xlsx.
It says invalid expression. Can anyone tell what am I doing wrong?
You are getting syntax error because of missing group by statement.
Kindly provide your actual statement...
It should be something like below
Load A,
B,
C,
//Amount,
if(Sum[Amount] = 0, null(), Sum([Amount]),
D,
E,
F
FROM
ABC.xlsx
Group by A, B, C, D, E, F
or May be
Use as below, considering that you want to group by only one field A
=================
Load A, B, C, Amount, D, E, F From TableName;
Load A, If(Sum(Amount) = 0, Null(), Sum(Amount)) as TotalAmount Resident TableName Group By A;
==============================
Hope this helps...
In your expression, you are not wrapping the Sum and If function with ()
if(Sum[Amount] = 0, null(), Sum([Amount]),
try:
if(Sum(Amount) = 0, Null(), Sum(Amount)),
Depends on what you are trying to summarize "Amount" over. You're either trying to just check the value of "Amount" on the line you're on, or you're trying to get a sum of "Amount" over certain dimensions. Which is it?
Hi Vlad,
I want to get the Sum(Amount) over a field called Week.
This does not work
can i have your clear requirement??
if(condition , A(if cond. true), B(if cond. false) )..this is the syntax.....check urs
...
Then you'd need a GROUP BY statement (which only works from a RESIDENT load):
data:
LOAD
Week,
Amount,
A,
B,
FROM
...
data2:
LOAD
Week,
sum(Amount) as Amount
RESIDENT data
GROUP BY Week
;
If you have a more specific problem, please post more specifics 🙂
Vlad
You are getting syntax error because of missing group by statement.
Kindly provide your actual statement...
It should be something like below
Load A,
B,
C,
//Amount,
if(Sum[Amount] = 0, null(), Sum([Amount]),
D,
E,
F
FROM
ABC.xlsx
Group by A, B, C, D, E, F
or May be
Use as below, considering that you want to group by only one field A
=================
Load A, B, C, Amount, D, E, F From TableName;
Load A, If(Sum(Amount) = 0, Null(), Sum(Amount)) as TotalAmount Resident TableName Group By A;
==============================
Hope this helps...
you missed ")"..
This helps.. Thanks!!!