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: 
techvarun
Specialist II
Specialist II

Remove negative values urgent

Hi Folks

                  am designing a barchart which is having a dimention "=class([Overdue Days],30)"  but in this clasification  i have a data range "-30<=x<= 0" i want to display only positive range.


Please anyone help me out its urgent

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

=class(RangeMax([Overdue Days],0),30)

View solution in original post

9 Replies
hic
Former Employee
Former Employee

=class(RangeMax([Overdue Days],0),30)

techvarun
Specialist II
Specialist II
Author

Thanks Henric,

                    It worked like a charm .

I have one more doubt, how to set the upper limit in class function?

may be i dont want the days after 120 what condition do i need to write.

Thanks in Advance

hic
Former Employee
Former Employee

There are several ways to do this, but I would probably go for

=If( [Overdue Days]>120,

     Dual('>120',130),

     Class(RangeMax([Overdue Days],0),30)

    )

And I would do it in the script. There is no need to calculate this array more than once. If you instead use a calculated dimension to define it, this calculation would steal cpu-power every time you click.

HIC

techvarun
Specialist II
Specialist II
Author

Thank you HIC

techvarun
Specialist II
Specialist II
Author

Just noticed that It is clubing the negative values to the range 0<=x<=30

I want the range values "-30<=x<= 0" should be removed from the chart.

Please anyone help me its urgent

Regards

hic
Former Employee
Former Employee

Yes, that is what the RangeMax does. If you instead want to remove them altogether, use

=If( [Overdue Days]>120,

     Dual('>120',130),

     If( [Overdue Days]>0,Class([Overdue Days],30))

    )

HIC

techvarun
Specialist II
Specialist II
Author

Thanks HIC

     I have tried this


=If( [Overdue Days]< 0,

          Dual('>0',130),

          Class(RangeMax([Overdue Days],0),30)

         )

but one problem is it is showing only odd number expressions like 30,60(missing),90,120(missing),150.

any correction to be made?

Regards

techvarun
Specialist II
Specialist II
Author

Sorry HIC by this formula am getting the values but still it is showing the values less than zero

attached is the result image

please clarify. btw why we are using the number 130 in this formula?

Regards

hic
Former Employee
Former Employee

You need to assign NULL to values below zero. You now assign 130 displyed as '>0' to these. Further, you wanted to group everything greater than 120 in one class, for which I suggested a Dual('>120',130), i.e. the numeric value is 130 but it is displayed as '>120'.

Isuggest you try

=If( [Overdue Days]>120,

     Dual('>120',130),

     If( [Overdue Days]>0,Class([Overdue Days],30))

    )

which does both of the above things.

HIC