Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
guster999
Creator
Creator

TOTAL bar needed on a stacked bar chart

Hi - I have a stacked bar chart as below and wish to add a bar for overall at the top(combining the results from my 'Group' dimension).  Please how do I create this in the chart, or within dimension load given the setup below?

thankyou🙂

Gus

guster999_0-1668120808546.png

My 'Group' dimension is created from inline as per below sample:

CostCentre:
LOAD * INLINE [
CostCentre,Area,Group
'10','Corporate Services','Corp-Support'
'11','Corporate Services','Corp-Support'
'12','Marketing','Corp-Support'
'13','Corporate Services','Corp-Support'

which joins via CostCentre to my main table load.

My 2 DIMs for chart are Group and length of service, and my measurement is:

Count({<[Employee Status Description]-={'Board','Casual','Volunteer'},[Termination Date]={""}>}distinct [Employee Name])
/
Count({<[Employee Status Description]-={'Board','Casual','Volunteer'},[Termination Date]={""}>} TOTAL <Group> distinct [Employee Name])

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Duplicate the rows for each group under TOTAL

CostCentre:
LOAD * INLINE [
CostCentre,Area,Group
'10','Corporate Services','Corp-Support'
'11','Corporate Services','Corp-Support'
'12','Marketing','Corp-Support'
'13','Corporate Services','Corp-Support'

];

Concatenate(CostCentre)

Load CostCentre,Area,'TOTAL' as Group Resident CostCentre;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

4 Replies
vinieme12
Champion III
Champion III

Duplicate the rows for each group under TOTAL

CostCentre:
LOAD * INLINE [
CostCentre,Area,Group
'10','Corporate Services','Corp-Support'
'11','Corporate Services','Corp-Support'
'12','Marketing','Corp-Support'
'13','Corporate Services','Corp-Support'

];

Concatenate(CostCentre)

Load CostCentre,Area,'TOTAL' as Group Resident CostCentre;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
guster999
Creator
Creator
Author

thanks so much Vineeth, that works a treat.😎

I had noted I'm getting 101% for the stack for just the TOTAL bar (I assume due to rounding), is there an easy fix for that without impacting the other bars?

thanks

guster999_0-1668138318425.png

 

BoXiangWang
Contributor III
Contributor III

Hi,

Thanks for your reply. I'd like to know how you managed to combine the GrandTotal to the original stacked bar chart? Could you share your expression? Thank you.

guster999
Creator
Creator
Author

Hi,

load editor below:

CostCentre:

LOAD * INLINE [

CostCentre,Area,Group

'10','Corporate Services','Corp-Support'

'11','Corporate Services','Corp-Support'

……..

'77','Projects','Corp-Support'

'510','EAS','EAS'

];

Concatenate(CostCentre)

Load CostCentre,Area,'TOTAL' as Group Resident CostCentre;

Then, in the chart itself:

guster999_0-1729224365109.png

 

And measure expression below:

Count({<[Employee Status Description]-={'Board','Casual','Volunteer'},[Termination Date]={""}>}distinct [Employee Name])
/
Count({<[Employee Status Description]-={'Board','Casual','Volunteer'},[Termination Date]={""}>} TOTAL <Group> distinct [Employee Name])