Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am writing this expression in Resident table, but it is throwing me an error:
SUM([FARE]+ [TAX])+ SUM(IF([DOCTYPE]='2',(-1*fabs(IsNull([MEAL AMOUNT]),0)), fabs(IsNull([MEAL AMOUNT]),0)))
AS [TOTAL FARE],
Please suggest.
Regards,
Balraj
SUM([FARE])
+ sum([TAX])
+ SUM(
IF([DOCTYPE]='2',
(-1*fabs(IsNull([MEAL AMOUNT]) =-1,0)),
fabs(IsNull([MEAL AMOUNT]) =-1,0)))
fabs has 1 parameter
what do you want to achive/to sum?
isnull(MEAL_ACCOUNT) is a condition and Returns -1 or 0
sum(-1*fabs(MEAL_ACCOUNT) if MEAL_Count is null? _1*0 = 0 can be achieved easier
RUDOLF,
MY MENTIONED EXPRESSION THROWING A SYNATX ERROR, THESE ARE THE SOME PARAMETER TO ACHIVE SOME RESULT IN BUSINESS.
CORRECT ME IF I AM MAKING ANY MISTAKE IN EXPRESSION.
As Massimo said, function fabs() has one parameter. You're trying to use two, this is your syntax mistake.
As for the business - I don't understand your third sum. What are you trying to calculate here?
isnull in TSQL like ISNULL(a,b) returns b if a is null
But it is not in QlikView which is like the IsNull in Basic, Isnull returns True or False (-1 or 0)
Besides, Fabs requires only one parameter and returns the Absolute value Fabs(-20) = 20
Your IsNull([MEAL AMOUNT]),0) should read like so:
If(IsNull([MEAL AMOUNT), 0, [MEALAMOUNT])