Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all.
Is there any way to share an expression across different objects??
I mean, once you have coded a complex expression useful not only in one object, but in the whole document, it would be nice if you could select it (the expression) from some kind of library whenever you need it in other objects. If not, you have to code it whenever you need it...
Going further, it would be nice to reuse expressions in different QV documents. Any idea on how to do this?
Regards,
Julio.
You can assign the expression to a variable and then refrence the variable in your charts.
-Rob
Thanks a lot Rob.
I knew you can reuse simple calculations, but is it possible to include dimensions and KPIs of the data model in these variables?
Do you have any example of complex calculations in variables making use of dimensions / KPIs of the data model?
Thanks and regards,
Julio.
Hi Julio,
You also bring the expression as part of the data sources and make use of them.
Rajesh
Thanks Rajesh.
I don´t understand your reply properly... do yo mean "to include the calculation performed by the expression into the data model??
Anyhow, is it possible to use fields from the data model in the variables?
Regards,
Julio.
Julio Navarro wrote:I knew you can reuse simple calculations
Julio,
I was not suggesting reusing results, like a column reference. I was suggesting putting the expression text itself in a variable.
SET vCommission = sum(Sales) * if(sum(Sales) < 1000, 0.15, 0.10);
SET vTaxRate = if(max(year) <= 2010, 0.012, 0.011);
And then in a chart use:
=$(vCommission)
and you can combine them like:
=$(vCommission) * $(vTaxate)
Does that help answer your question?
For another example, see the Qlikview Cookbook sample titled "User Defined Function example.". You can download the Cookbook from
http://robwunderlich.com/Download.html
-Rob