Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Multi Color Stacked Bar chart

Hello,

I am new to qlikview and currently  working on a requirement to represent data as shown in attached snap shot.

In attached snap shot 2 bars are representing 2 metrics.and no dimensions used

1. Available Hours  = Sum of Non-Chargeable + Sum of Chargeable Hours

2. Stacked bar chart of Non-Chargeable and Chargeable Hours.

Is there a way to achieve such chart?

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

To create your total and your detailed bar, you can do something like this:

Create a synthetic dimension like

=ValueList('1','2')

Then three expressions:

=If(ValueList('1','2')= 1, Rangesum(Sum(Value1), Sum(Value2) ) )

=If(ValueList('1','2')= 2, Sum(Value1) )

=If(ValueList('1','2')= 2, Sum(Value2) )


You can hide the dimension label on dimension tab and then set style to stacked on presentation tab.



StackedGrouped.png

View solution in original post

6 Replies
engishfaque
Specialist III
Specialist III

Dear Pradeep,

For stack chart, kindly follow the listed below steps:

Chart Properties > Style Tab > Subtype > Select "Stacked" radio button > Apply > OK.

Kind regards,

Ishfaque Ahmed

Anil_Babu_Samineni
MVP
MVP

Please send the qvw file. So that, We can respond back and easy to monitor also....

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

Hello Ishfaque,

Thanks for your response. However, my requirement is different here.

I have 2 metrics displaying in the form of bars.

1st bar in the chart indicates metrics 1 (=sum({<[HT] = {'Available'}>}Hours) ).

2nd bar indicates metric 2. But metric 2 aggregation is based on a conditional aggregation. (=sum({<[HT] = {'Non Chargeable','Chargeable'}>}Hours) ).

As metric 1 is derived from a single condition , there needs to be only one color for bar.

But since metric 2 is derived based on 2 values , we need 2nd bar in 2 colors.

Thanks,

Pradeep

swuehl
Champion III
Champion III

To create your total and your detailed bar, you can do something like this:

Create a synthetic dimension like

=ValueList('1','2')

Then three expressions:

=If(ValueList('1','2')= 1, Rangesum(Sum(Value1), Sum(Value2) ) )

=If(ValueList('1','2')= 2, Sum(Value1) )

=If(ValueList('1','2')= 2, Sum(Value2) )


You can hide the dimension label on dimension tab and then set style to stacked on presentation tab.



StackedGrouped.png

HirisH_V7
Master
Master

Hi,

By using the sample data,

Data:

LOAD * INLINE [

    Non-Chargeble, Chargeable

    1, 2

    2, 1

    4, 2

];

Creating a stacked bar chart using ,

Dimension:-

=ValueList(1,2)

Expressions:-

If(Valuelist(1,2)=2,Sum(Chargeable))

If(Valuelist(1,2)=2,Sum([Non-Chargeble]))

If(Valuelist(1,2)=1,Sum(Chargeable)+Sum([Non-Chargeble]))


stacked chart will look like this,

Stacked Bar No Dimension-217180.PNG

HTH,

PFA,

Hirish

HirisH
Not applicable
Author

Thanks alot Wuehl. This is what i needed. And i followed the approach you mentioned and it is working as expected.

Thanks alot again.