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

Multiple Condition in expression

Hi

I have this below mentioned expression which gives average transaction value for last seven days ,But i need to put some conditions where based on the country the value will be multi plied by the respective currency can any one help me in that.

((Sum($(Last7Days)FullAmount)+Sum($(Last7Days)DiscountAmount))/Count($(Last7Days)Distinct TransactionSlip))

6 Replies
migueldelval
Specialist
Specialist

Hi Arindam,


I consider that Last7Days is a variable, isn´t it. And I considered that your expresssion it´s correct.


The expression with more variables will be.


(

     (

          Sum({<$(Last7Days), country={""},currency={""}>}FullAmount)

          +

          Sum({<$(Last7Days), country={""},currency={""}>}DiscountAmount)

     )

     /

     (

          Count($(Last7Days)Distinct TransactionSlip)

     )

)


You only need to put the required values into "".


Regards


Miguel del Valle

Not applicable
Author

Hi Miguel

I want a conditional expression where if my country is usa the above mentioned expression will be multiplied by  say 50 and if it is Germany then with 40 like that.

migueldelval
Specialist
Specialist

Hi Arindam:

It is change the answer.

For this you need a conditional expression:

=If

     (

     contry='usa',

     Expression*50,

     if

          (

          country='German',

          Expression*40,

          0  //or the other result thet you consider

          )    

     )

For example

Regards

Miguel del Valle

Not applicable
Author

Hi Miguel

Thanks for the reply I tried with this but it is giving me the same result conditional  output is not coming.

Not applicable
Author

Hi Arindam,

Create a new inline table in the script:

LOAD * INLINE [

    Country,Currency

    USA,50

    Germany,40

];

Keep a list box for Country.

Expression:

((Sum($(Last7Days)FullAmount)+Sum($(Last7Days)DiscountAmount))/Count($(Last7Days)Distinct TransactionSlip))*Currency


Hope this helps.


Regards,

Rohan

Not applicable
Author

Hi Rohan

thanks a lot This one has worked .I have inserted a new table and the expression looks liek this now

((Sum($(Last7Days)(FullAmount*Currency))+Sum($(Last7Days)(DiscountAmount*Currency)))/Count($(Last7Days)Distinct TransactionSlip))

Arindam