Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Suppose I have 3 widgets (gauges) each with a numeric definition such as 20, 30, 40
I wish to display the average of these definitions in a 4th widget.
What is the cleanest way to do this?
There's probably a more elegant solution depending on what the document looks like but how about:
Sum(Expr1 + Expr2 + Expr3) / 3
If you're using dimensions on the gauges you might have to modify the expression though so that Exp1 - 3 calculate the sums that you want.
Yes,
In particular, I want to know how to say "Expr1".
That is, from widget 4, how to say widget4 = "widget3.expression" to describe it in an OOP way.
If you are using ver. 8.5, look at Set Analysis - that's as close as you get.
QlikView expressions are not OOP, but you can get the same result in a different way...
Oleg
ok thanks, just wanted to check 🙂
A non fancy way to deal with this is to always define all expressions as variables in the load script.
Defining expr1, expr2, expr3 and then let expr4 be sum(expr1+expr2+expr3)/3
That typically saves me some time especially when I have to make changes to expressions.
See I ask this because I noticed that widgets have an object identifier.
For example CH23.
Now I'm trying to build up a set of dependancies, of data, rather.. a roll up of data i.e.:
A is B+C
B is D+E
C is F+G
D is.... etc...
Somewhere at the bottom the raw data is kept.
Now with this top down, approach, the expressions become huge, so I was hoping that I could just abstract away the resulting 'expression definitions' and access them via the object identifier.
I'm just trying to find an elegant way to roll up data, top down or bottom up, (top down now seems unlikely).
Thanks
The RangeAvg function would also work.
RangeAvg(expr1, expr2, expr3)
you can do it (to a degree...) using expressions stored in variables. For example:
SET exp_Sales = 'sum(Sales)';
SET exp_Cost = 'sum(Cost)';
Then, in your chart expressions, you can operate with those "building blocks":
= ( $(exp_Sales) - $(exp_Cost) ) / $(exp_Cost)
I'm not sure if you can use nested expressions though...
Oleg