3 Replies Latest reply: Nov 2, 2016 4:49 AM by Tresesco B

# How to sum with multiple fields with analysis?

Hi all,

I would like to add analysis to below expression,

Sum(SALES_QUANT*SALES_COST)

Is it possible to sum with multiple fields with analysis? like below example,

Sum(({\$<[Field A] = {">0"}, [Field B] = "123">}SALES_QUANT)*({\$<[Field C] = {">10"}, [Field D] = "456">}SALES_COST))

Best Regards,

Louis

• ###### Re: How to sum with multiple fields with analysis?

Hi Louise,

It's not possible to use your expression.

The best way is you create sales_quantity and sales_cost condition field on data load editor.

example :

if( FieldA >0,

if( FieldB = 123, Sales_quantity)) as Sales_quantity,

if( FieldC >10,

if( FieldD = 456, Sales_cost)) as Sales_cost,

then in your expression you can use sum(sales_quantity*sales_cost)

or if you want to put condition in your expression, you can use this script.

sum(

if( FieldA >0,

if( FieldB = 123, Sales_quantity))*

if( FieldC >10,

if( FieldD = 456, Sales_cost))

)

Regards,

Marco

• ###### Re: How to sum with multiple fields with analysis?

Why not just this:

Sum({\$<[Field A] = {">0"}, [Field B] = {123}>}SALES_QUANT*SALES_COST)

• ###### Re: How to sum with multiple fields with analysis?

Try like:

Sum({\$<[Field A] = {">0"}, [Field B] = {'123'}>}SALES_QUANT) * Sum({\$<[Field C] = {">10"}, [Field D] = {'456'}>}SALES_COST)