Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

3 Replies
marcohadiyanto
Partner - Specialist
Partner - Specialist

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

sunny_talwar

Why not just this:

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

tresesco
MVP
MVP

Try like:

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