Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Use an expression result within another expression

Is it possible to create a new expression to calculate the amount of instances whereby a number is greater than a predefined number, and then use the results of that expression within another expression?

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Use an expression result within another expression

Well, to begin with get rid of the vDelayMins: in the expression. Then it looks the same as your second expression. It will work, but that's probably not what you want. If you press CTRL+V the variables screen opens. If you click on Add you can add a variable you can name vDelayMins. Once you've added it you can click on it and give it as value Sum(SCH)-Sum(CHKS). You can then create an expression in your chart with for example as definition if($(vDelayMins)<-15,'Delayed','Not Delayed')


talk is cheap, supply exceeds demand
9 Replies
MVP & Luminary
MVP & Luminary

Re: Use an expression result within another expression

Yes, that's possible. To make reuse easier and improve readability you can put the first expression in a variable and use the variable in the second expression.

vSumSales: sum(Sales)

Expression2: aggr($(vSumSales),Month)


talk is cheap, supply exceeds demand
Not applicable

Re: Use an expression result within another expression

Hi I have tried to put my first expression in a variable as you have stated but the data just disappears.

my expression reads:

vDelayMins: Sum(SCH)-Sum(CHKS)

then I was going to load DelayMins to calculate the amount of data that has a value of -15 or more

MVP & Luminary
MVP & Luminary

Re: Use an expression result within another expression

See attached example. It has a variable vYearDiff that calculates the sales difference between two years. This variable is then used in the expression Diff 2008 - 2009 in the straight table: if($(vYearDiff)>0,'Up','Down'). If the result of vYearDiff > 0 then sales increased, otherwise the declined.


talk is cheap, supply exceeds demand
Not applicable

Re: Use an expression result within another expression

Im not able to load the file as I did not create it

Not applicable

Re: Use an expression result within another expression

I have taken a screen shot can you advise where I am going wrong.

Instaed of a - the two columns should be displaying the same information. once I get the first column to deiplay the correct informtion I can then start to build the if statement to calculate the number greater than -15

DELAYMIN.png

MVP & Luminary
MVP & Luminary

Re: Use an expression result within another expression

Well, to begin with get rid of the vDelayMins: in the expression. Then it looks the same as your second expression. It will work, but that's probably not what you want. If you press CTRL+V the variables screen opens. If you click on Add you can add a variable you can name vDelayMins. Once you've added it you can click on it and give it as value Sum(SCH)-Sum(CHKS). You can then create an expression in your chart with for example as definition if($(vDelayMins)<-15,'Delayed','Not Delayed')


talk is cheap, supply exceeds demand
Not applicable

Re: Use an expression result within another expression

Hi firstly as I havent stated yet thank you so much for trying to help me resolve this issue with such prompt responses.

I have took two more screenshots as I had initially done as you said but the information still showed a -

pic1.pngpic2.png

MVP & Luminary
MVP & Luminary

Re: Use an expression result within another expression

You didn't do the dollar expansion yet. Change the definition of the expression to $(DELAYMIN)


talk is cheap, supply exceeds demand
Not applicable

Re: Use an expression result within another expression

Hi that worked a treat figures populated thanks so much, my second part I had hoped would have been resolved by the if statement you created it shows all as not delayed if if the value is less than -15 ie say -3 still showing not delayed