Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

SIMPLE?

Hi

i have

coloumn 1  having Yes,No

coloumn 2  having    100

coloumn 3 having   50

my req is

if(coloumn1='Yes',max(fabs(coloumn(2)+3*coloumn(3)),fabs(coloumn(2)-3*coloumn(3))

i have used because i have negative values in my data

i want get when coloumn 1 is Yes  then max(coloumn(2)+3*coloumn(3)),fabs(coloumn(2)-3*coloumn(3)))

ex:   max(100+3*50,100-3*50)   = max(250,50)   it should return   250  for Yes

it means  for yes only i want see data

if it is no  then i want get blank space

how to write a condition for this

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

In your graph, use coloumn 1 as a dimension and the expression will be:

if(coloumn1='Yes',RangeMax(fabs(coloumn(2)+3*coloumn(3)),fabs(coloumn(2)-3*coloumn(3)))

View solution in original post

9 Replies
datanibbler
Champion
Champion

Hi CommonQlik,

where do you want to do this calculation?

In the script or on the GUI?

I would guess in the script - that would be better, performance-wise, and as the calculation depends on a column in the table, it won't be changed by the user.

Then write it, pretty much like you have it,

>> IF([column1] = 'YES', max([column2] + (3*[column3])), max([column2] - (3*[column3])) <<

Just keep in mind that in the script, since you use the aggregation_function max(), you need a GROUP BY clause to encompass all other fields in the LOAD - so if there are fields that you don't want to  build groups on, you will have to leave those aside and join them to the outcome of this again.

HTH

Best regards,

DataNibbler

Anonymous
Not applicable
Author

I WANT IN THE CHART LEVEL

Anonymous
Not applicable
Author

Hi,

In your graph, use coloumn 1 as a dimension and the expression will be:

if(coloumn1='Yes',RangeMax(fabs(coloumn(2)+3*coloumn(3)),fabs(coloumn(2)-3*coloumn(3)))

PradeepReddy
Specialist II
Specialist II

Try the expression:

=if(Coloumn1='Yes',rangemax(fabs(Coloumn2+3*Coloumn3),fabs(Coloumn2-3*Coloumn3)),' ')

Where Coloumn1, Coloumn2, Column3 are Coloumn names in the table.

Anonymous
Not applicable
Author

Ok

but it it is showing data for   Column1= No  also

Anonymous
Not applicable
Author

is it showing the same results for no? or something like 0?

Anonymous
Not applicable
Author

Not same result and not 0  giving some output like for yes

Anonymous
Not applicable
Author

can u show a screenshot and paste the exact expression you use in your graph?

Anonymous
Not applicable
Author

got it now it is showing values for only Yes

but if the value suppose to come 50.3  but i am getting 50.6 here