Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Condition for picture objects

Hi everyone!


I have a condition in objects which stops working if there is no data. Is it possible to fix it?


There are indicators in my QV document which are calculated and represented per month (in dynamics). At the same time for each indicator there is a separate index which is estimated only for the current month:

avg({<MONTH={"$(=max(MONTH))"}>}Field)


For each index there is an arrow identifying is it higher, lower or at the same level as in previous month. Condition for an arrow that represents growth is the following:

len(MONTH) <> 1 and avg({<MONTH={"$(=max(MONTH))"}>}Field)-avg({<MONTH={"$(=max(MONTH,2))"}>}Field)>=1


Problem:

If there is no data in any month, my condition stops working and an arrow is represented despite that (despite there is no data that should be compared).


How condition should be fixed to make it working properly?


Many thanks in advance!

Marina



4 Replies
qlikmsg4u
Not applicable

Re: Condition for picture objects

May be something like, I am not sure but give a try

If(IsNull(avg({<MONTH={"$(=max(MONTH))"}>}Field)),0,avg({<MONTH={"$(=max(MONTH))"}>}Field))

Not applicable

Re: Condition for picture objects

K N,

unfortunately,it is not working. But probably I did something wrong: I need to change this condition for arrows:

len(MONTH) <> 1 and avg({<MONTH={"$(=max(MONTH))"}>}Field)-avg({<MONTH={"$(=max(MONTH,2))"}>}Field)>=1

Using your idea, I've run the following:

If(IsNull(avg({<MONTH={"$(=max(MONTH))"}>}Field)),0,
len(MONTH) <> 1 and avg({<MONTH={"$(=max(MONTH))"}>}Field)-avg({<MONTH={"$(=max(MONTH,2))"}>}Field)>=1)

Did I make it correct?

qlikmsg4u
Not applicable

Re: Condition for picture objects

Marina,

Try this expression and replace the images with your images

=IF(Alt(avg({<MONTH={"$(=max(MONTH))"}>}Field),0)-Alt(avg({<MONTH={"$(=max(MONTH,2))"}>}Field),0)>=1,'qmem://<bundled>/BuiltIn/arrow_n_g.png','qmem://<bundled>/BuiltIn/arrow_s_r.png')

Arjunarao
Not applicable

Re: Condition for picture objects

Hi Marina_M

Can attach the file with sample data. It will help us for better understanding your issue and provide the right solution. Thank you.