Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statement that for some reason doesn't work

Hey Everyone ,

I am trying to run the following IF statement :

IF(EnCurrency='NIS',Num(sum( {$< TRANS_TYPE = {N}>}  NIS_TRANS_TOTPRICE  )* -1,

IF(EnCurrency='$',Num(sum( {$< TRANS_TYPE = {N}>}  DOLLAR_TRANS_TOTPRICE )* -1,

IF(EnCurrency='EUR',Num(sum(  {$< TRANS_TYPE = {N}>}  CURRENCY_TRANS_TOTPRICE)* -1 ))))  ;

EnCurrency= CURRENCY

for some reason this If statment doesn't

1 Solution

Accepted Solutions
reddy-s
Master II
Master II

Hi Jhonatan,

I tried plotting the dimension "EnCurrency" and the measure with the expression:

IF(EnCurrency='NIS', Sum( {$< TRANS_TYPE = {N}>}  NIS_TRANS_TOTPRICE  )* -1,

     IF(EnCurrency='$', Sum( {$< TRANS_TYPE = {N}>}  DOLLAR_TRANS_TOTPRICE )* -1,

          IF(EnCurrency='EUR', Sum(  {$< TRANS_TYPE = {N}>}  CURRENCY_TRANS_TOTPRICE)* -1

           )

     )

)

Works absolutely fine!

Capture.PNG

Try using a bar chart to test the expression!

View solution in original post

14 Replies
Chanty4u
MVP
MVP

IF(EnCurrency='NIS',Num(sum( {$< [TRANS_TYPE ]= {'N'}>}  NIS_TRANS_TOTPRICE  )* -1,

IF(EnCurrency='$',Num(sum( {$< [TRANS_TYPE] = {'N'}>}  DOLLAR_TRANS_TOTPRICE )* -1,

IF(EnCurrency='EUR',Num(sum(  {$< [TRANS_TYPE ]= {'N'}>}  CURRENCY_TRANS_TOTPRICE)* -1 ))))  ;

swuehl
MVP
MVP

In which context are you trying to use this statement? In the script or in a chart? If it's in a chart, what are the chart dimensions?

Besides that, I think the syntax is not valid, double check the opening and closing brackets.

IF(EnCurrency='NIS', Sum( {$< TRANS_TYPE = {N}>}  NIS_TRANS_TOTPRICE  )* -1,

     IF(EnCurrency='$', Sum( {$< TRANS_TYPE = {N}>}  DOLLAR_TRANS_TOTPRICE )* -1,

          IF(EnCurrency='EUR', Sum(  {$< TRANS_TYPE = {N}>}  CURRENCY_TRANS_TOTPRICE)* -1

           )

     )

)

reddy-s
Master II
Master II

Hi Jhonatan,

If this condition is in the script it wont work at all, but if its in the UI side as an expression, make sure that one of the dimensions is "EnCurrency".

Not applicable
Author

Hey Swuhel

i am trying to use this is as shippment returns caculation,

NIS = means New Isareli Shekel ( Israeliy coin) name.

EnCurrency = type of  CURRENCY.

i tried to run the script you wrote down and didn't work ....

ogster1974
Partner - Master II
Partner - Master II

Why don't you try this.  It will perform better than a nested if statement to...

pick(match(EnCurrency,'NIS','$','EUR'),

// NIS

, Num(sum( {$< TRANS_TYPE = {N}>}  NIS_TRANS_TOTPRICE  )* -1)

//

, Num(sum( {$< TRANS_TYPE = {N}>}  DOLLAR_TRANS_TOTPRICE )* -1)

// EUR

, Num(sum(  {$< TRANS_TYPE = {N}>}  CURRENCY_TRANS_TOTPRICE)* -1)

)

Not applicable
Author

Hey Reddys310 ,

i defined it as a Measure on my report,

and in the script i have defined the EnCurrency  on the script:

CURRENCY_TABLE:

LOAD * INLINE [

    Currency,EnCurrency,Rcurrency

    ₪, NIS,сикель

    €, EUR,ЕВРО

    $, $,доллар

];

reddy-s
Master II
Master II

Hi Jhonatan,

Is EnCurrency one of the dimmensions in your visualization? If not you need to have that as a dimmension to make the expression work.

Not applicable
Author

Hey Ogster1974,

tried your script but didn't work.

swuehl
MVP
MVP

Or you need to select exactely one value from field EnCurrency (or from fields Currency, Rcurrency).