Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Help with Expression

Hi,

Not sure if this is possible; I am trying to create a conditional expression to sum the values based on the Product_Unit.

So if Product_Unit='CBM', sum CBMUnit, else sum OtherUnit.

Is this possible?

sum({$<Product_Unit={CBM}>} CMBUnit)

Product_UnitCBMUnitOtherUnit
CBM50
CBM50
KG02
KG02
KG02

thanks

Derrell

6 Replies
Not applicable
Author

try this:

sum({$<Product_Unit={'CBM'}>} CMBUnit)

Anonymous
Not applicable
Author

Sum(Pick(WildMatch(Product_Unit, 'CBM')+1, OtherUnit, CBMUnit))

Anonymous
Not applicable
Author

Try this:(it happened for me and below worked)

=(if(Product_unit='CBM', Sum({<Product_unit={'CBM'}>} CBM_unit),Sum(Other_unit)))

This will work.

if not try this.

=(if(Product_unit='CBM', Sum({<Product_unit={'CBM'}>} Total <Product_unit> CBM_unit),Sum(Total <Product_unit> Other_unit)))

Hope this helps.

Regards,

Chinna

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this using two Sum()


=Sum({<Product_Unit={'CBM'}>} CMBUnit) + Sum({<Product_Unit-={'CBM'}>} OtherUnit)


Note : The above expression is shown as syntax error near -=, but it works ignore that error.


Regards,

Jagan.

jagan
Luminary Alumni
Luminary Alumni

or you can just simply give

Sum(CBMUnit + OtherUnit)

because if Product_Unit=CBM you have the other Unit as 0 and vice versa.  So this also works.

Regards,

jagan.

Not applicable
Author

HI,

This should be work.

Sum(CBMUnit + OtherUnit)


Priyantha