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: 
Not applicable

How to Create custom variable and use them in other expressions

Hi All ,

This is Ravindra Mandre and just before sometime started working on qlikview  and obviously new to it.

While doing some table operations I came to a requirement of creating some custom variables that can be used in other calculations and other expressions which includes the use of created varibles . for example

I wanted to create one variable which will do some calculation like this 

output_a= Count(variable_a) or AVG(variable_a)

and then variable_a does some other calculations like 

variable_a = if(someDate=Now(2) and otherDate=SOME_OTHER_DATE, true , false);

So my question is that How I can create the custom variables so that I can use them into my calculations without repeating the same calculations again and again.

Please help .

Thanks & Regards

Ravindra Mandre

1 Solution

Accepted Solutions
louwriet
Creator
Creator

Hi Ravindra,

I hope I understand you right what you are trying to achieve.
To give you an example

Let say you have 2 variables :
eIncomeExl   =  sum(AmountExcl)
eDedutionsExl = sum((Deductions) * (-1))     /114 * 100

Then I create another variable:
eSales = $(eIncomeExl) - $(eDedutionsExl)


Then in my Qlikview expression I would want the sales I use   =$(eSales)
or if you just need the income in the expression you can just use use   =$(eIncomeExl)

View solution in original post

3 Replies
Not applicable
Author

Hello Ravindra,

I am not quite sure, but the $-sign expansion should help you.

For ex. :

output_a= Count( $(variable_a) ) or

output_a= Count( $(=variable_a) )

For further details please see help

Regards, Roland

Note:

For testing purpose or getting started you can edit some easy expressions in a textbox and see what's happening.

louwriet
Creator
Creator

Hi Ravindra,

I hope I understand you right what you are trying to achieve.
To give you an example

Let say you have 2 variables :
eIncomeExl   =  sum(AmountExcl)
eDedutionsExl = sum((Deductions) * (-1))     /114 * 100

Then I create another variable:
eSales = $(eIncomeExl) - $(eDedutionsExl)


Then in my Qlikview expression I would want the sales I use   =$(eSales)
or if you just need the income in the expression you can just use use   =$(eIncomeExl)

Not applicable
Author

Hi Louwrie,

Many thanks for you reply and it helped  me a lot.

Roland thanks to you also for reply.

Regards

Ravindra Mandre