Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using two variables for expression

Hello guys,

i want to create a expression between two excisted variables.

  1.   vGrossSales =                    sum(TransactionQuantity*SalesPrice)
  2.    Netto_Return_Value =                  sum(GrossValue-DiscountValue)

i would like to create a new variable called vNettoSales from the two variables upstairs. the formule is : vNettoSales = vGrossSales - Netto_Return_Value.

how can i create this vNettoSales variable? any examples?

Thanks in advances!

Greets,

Rega

8 Replies
sunny_talwar

Are you creating the variables in the script or through variable overview on the front end?

Not applicable
Author

Front End

trdandamudi
Master II
Master II

In the variable overview you create the below variable:

vNettoSales = ( vGrossSales - Netto_Return_Value)


Then in your charts you can use it as =$(vNettoSales )


avinashelite

try like this

vNettoSales = vGrossSales - Netto_Return_Value


or

vNettoSales= sum(TransactionQuantity*SalesPrice) - sum(GrossValue-DiscountValue)

Not applicable
Author

Hello Thirumala,

Thank you. But i have a new challenge and you can see underneath in the picture:

I created a straight table with the labelname 2016 Netto Sales with the folowing expression:

sum({$<Year={'2016'}>}$(vNettoSales ))

unfortunatly i can't see any result in the the straight table.  probably a wrong expression?

Thanks!

Rega

avinashelite

Yes your expression is wrong

sum({$<Year={'2016'}>}$(vNettoSales ))


you should have a field to use the set analysis expression


try like this


sum({$<Year={'2016'}>}TransactionQuantity*SalesPrice) - sum({$<Year={'2016'}>}GrossValue-DiscountValue)


if not yielding the right results ..please explain your requirement



sunny_talwar

Or use variables with parameter:

Variables with Parameters

trdandamudi
Master II
Master II

Your expression is wrong. Can you share a small sample please...