Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stacked bar chart problem

I have two types of hours.

Hours 1 are shown at the process level.

Hours 2 are shown at the sub-process level. I was initially told that Hours1 > Hours2 always.

My bar chart needs to show stacked Hours2 and Hours3 (which represent the difference of Hours1-Hours2).

My bar chart works well, unless  Hours1<Hours2 (which sometimes happens). I really don't need to show negative difference. It doesn't have to be a difference at all, just a separate category. I am sure there is a better way to do it.

Please see attached example.

1 Solution

Accepted Solutions
m_woolf
Master II
Master II

If you want Hours3 to always be positive, you can wrap it in the fabs() function:

fabs(Sum (DISTINCT Hours1) - Sum (Hours2))

View solution in original post

5 Replies
m_woolf
Master II
Master II

Try this expression for Hours3:

=if(Sum(DISTINCT Hours1) - Sum (Hours2)<0,0,Sum (DISTINCT Hours1) - Sum (Hours2))

Not applicable
Author

m w,  thank you for the answer. That fixed some extra brackets in the attached example. But this still doesn't solve the issue. e.g.: Process A has 5 Hours2 and  4 Hours1  - Only Hours2 are shown. I need to show both Hours2 and Hours3

m_woolf
Master II
Master II

I thought that Hours 3 by definition in your expression was zero.

If you don't want Hours3 to be negative and you don't want it to be zero, what do you want it to be?

Not applicable
Author

No. My expression is incorrect (it was a workaround based on the assumption that the difference will always be positive). But what I want to show is Hours2 and Hours3 stacked.

m_woolf
Master II
Master II

If you want Hours3 to always be positive, you can wrap it in the fabs() function:

fabs(Sum (DISTINCT Hours1) - Sum (Hours2))