Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Issue with IF in an expression

Hi,

I have a waterfall chart where values which are positive are green and values which are negative are red.

This works as expected.

My issue becomes more complex when i try to add the condition for the Total Column (in yellow).

The requirement is to have the Total coluum in another colour.

I am using the Dimensionality() =0 to identify the total column. This works outside of the IF statement.

However when I add this to the exisiting condition nothing happens.

Am I not seeing something obvious?

Any help appreciated.

Here is the expression for the background colour and the current graph

if(column(1)>0, Green(),

if(Dimensionality()=0, Black(),Red()))

Bonus equestion how do I identify the others colum in a table where the others is a result of a limited dimension.

May thanks in advance!

Paul

1 Solution

Accepted Solutions
balar025
Creator III
Creator III

Hello ,

Use below expression.

if(RowNo()=1 or Dimensionality()=0,0,RangeSum(Above(sum(Value),1,RowNo())))

Background Color:- if(Dimensionality()=0,Yellow(),if(Column(1)>0,Green(),Red()))

please find attached application for reference.

View solution in original post

5 Replies
Or
MVP
MVP

I feel like I'm missing something here, so I'll just ask: in your condition, if Column(1)>0, the result is always Green(). Your total is >0. Why shouldn't it be green?

Anonymous
Not applicable
Author

Or firstly thanks for your answer. It's much appreciated. I understand what you are saying.

The dimensionality of the Total colum is 0 so I was hoping that the Dimensionality()=0 would set the Black.

I see that my logic is wrong. Have you any idea how to go about this?

balar025
Creator III
Creator III

It is achievable. I don't have application handy.Can you please post your demo application?

balar025
Creator III
Creator III

Hello ,

Use below expression.

if(RowNo()=1 or Dimensionality()=0,0,RangeSum(Above(sum(Value),1,RowNo())))

Background Color:- if(Dimensionality()=0,Yellow(),if(Column(1)>0,Green(),Red()))

please find attached application for reference.

Anonymous
Not applicable
Author

Ravi,

Thanks so much!! This work. I should have played with my statement more. Thanks again for your help

Paul