Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
Not applicable

Stacked Bar Chart: Eliminate negative values from Total

Hi All,

I am trying to create a Stacked bar chart. My data has some negative valves.

Problem:

Total in stacked bar chart add the negative values instead of instead of subtracting it.

Ex: Total should be 2913

ie. Chock               Pen

3895-982

So for Mumbai sum of sales should be 2913.

However my graph shows total as 3895. Besides that I dont want to show negative values in bar chart.

If I do it with Pivot my Total comes correctly; if I apply stacked bar chart the values mess up.

Any help or pointers in this regard are appreciated.

3 Replies
nizamsha
Valued Contributor II

Re: Stacked Bar Chart: Eliminate negative values from Total

=if(sum(Sales)<=0,fabs(sum(Sales)),sum(Sales))

use the above one to add the positive and negative as a single bar

=if(sum(Sales)>=0,sum(Sales))

use the second one to omit negative bars

nizamsha
Valued Contributor II

Re: Stacked Bar Chart: Eliminate negative values from Total

I dont know excatly what you r asking but attached two solution

satishkurra
Valued Contributor II

Re: Stacked Bar Chart: Eliminate negative values from Total

Hi

Please use RangeMax function to eliminate Negative Values from the report.

In Chart Properties for Expressions Tab

RangeMax(Sum(Sales),0)

Thanks

Satish