Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
kvijayab
Contributor III
Contributor III

How to refer Chart expression by name in sort expression

Helo,

I have a bar chart with one dimension and one expression (say v1). This expression is complex and time consuming.

I want to sort the chart by asc or desc based on some condition. I was going to multiply the yvalue by -1/1 for this in the sort expression. But I dont want to write the complex expression again in sort expression and calculate it twice. This is giving performance issue. Instead I want to refer it by name (-1*v1) in sort expression.

I see one expression can be referred in another by name. Wondering if it can be in sort expression.

Dont want to have two charts with different sort orders.

Thanks,

VJ

6 Replies
kaushiknsolanki
Luminary Alumni
Luminary Alumni

Hi,

One thing you can do is copy the expression in variable and then call variable in expression and also for sorting expression.

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
Anil_Babu_Samineni

Yes, as Kaushik mentioned u have to declare that expresion in Sory by expression and then use ASC / DESC as client needs.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
kvijayab
Contributor III
Contributor III
Author

Thanks but I don't think this answers my question.

If you mean to solve repeating the expression text at two places then that is not my problem.

If you mean to calculate the variable value once and use it in multiple places, then it is not a calculate once and use it many time situation like a text box but a chart where the expression value by itself changes based on the dimension values. In fact my expression is in a variable only. It still calculates multiple times if used in chart expression and in sort expression, as intended.

kaushiknsolanki
Luminary Alumni
Luminary Alumni

Vijay,

In any which way it is going to be calculated twice. To optimize the performance you should look to optimize the calculations used in your expression.

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
kvijayab
Contributor III
Contributor III
Author

If one expression is referred by name in another expression then it wont be calculated twice. The question is if it can be done in sort expression. I guess the answer is no. Thanks for your reply though.

oscar_ortiz
Partner
Partner

Have you tried sorting by "Y" value?

Good luck

Oscar