Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On May 18th at 10AM EDT we will answer your QlikView questions live. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
rajeshvaswani77
Specialist III
Specialist III

Optimize if condition

Hi All,

We have a expression that reads

num(if(sum(XYZ)<0, 0, Sum(XYZ)),'$(UnitFormat)')

This seems to be consuming a high calculation time on a large document.

Is there a single function that can be used to optimize this to the best?

Note: for certain reasons we do not want to mention the dimension when we are calculating this.

thanks,

Rajesh Vaswani

5 Replies
ashfaq_haseeb

Hi,

Can you try below

if(sum(XYZ)<0, 0, num(Sum(XYZ),'$(UnitFormat)'))


Regards

ASHFAQ

Not applicable

You could try:

num(rangemax(0,Sum(XYZ)),'$(UnitFormat)')

Not sure if this will improve performance, but it may be worth a try.

marcus_sommer
MVP & Luminary
MVP & Luminary

Maybe you could use set analysis:

sum({< XYZ = {">0"}>} XYZ)

The units could you better show (dynamically) within the label.

- Marcus

Not applicable

Wouldn't you want to include negative values? Just because one of the values of XYZ is negative, doesn't mean the sum is below 0.

marcus_sommer
MVP & Luminary
MVP & Luminary

It will be depend from the data-structure. In some cases I use such logic. Maybe its worth to implement the sum-check within the set analysis but I think then will be the performance not really better ...

Perhaps another way could be to split these calculation in a table-chart with and reference i a second step on the other column.

- Marcus