Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
V_Gautam_Raju
Partner - Contributor
Partner - Contributor

Represent Total bar in bar chart

Can anyone help me how to show total bar(Sum of all other bars) at the end in bar chart.

Labels (4)
7 Replies
Aditya_Chitale
Specialist
Specialist

Concatenate a hardcoded flag 'Total' to your fact table dimension which you are using in your bar chart.

In frontend expression use if() condition : if(Dimension='Total' ,  sum(total measure) , sum(measure))

Eg:

test:
load * inline
[
month,sales
Jan,10
Feb,20
Mar,30
];

concatenate (test)

TotalTable:
load * inline
[
month
Total
];

Frontend expression:

if(month='Total' , sum(total sales) , sum(sales))

Aditya_Chitale_0-1676973135629.png

 

Regards,

Aditya

 

V_Gautam_Raju
Partner - Contributor
Partner - Contributor
Author

Thanks Aditya,
But my requirement is like this

V_Gautam_Raju_0-1676973873520.png

I want to show the right chart data in first chart and in filter I have to select months.    

Aditya_Chitale
Specialist
Specialist

@V_Gautam_Raju  I can't clearly understand your requirement just by looking at the screenshot. As mentioned by you earlier, you wanted total bar which sums up all other bars.

Do you want monthwise bar chart or Category wise bar with sum total shown as month ?

Regards,

Aditya

Or
MVP
MVP

That looks like an entirely different chart, with a different Y axis scale. If that's what you're after, just create two separate charts. If you were to add a total to the existing chart, typically this makes the component bars too small to be useful, so I'd recommend against that approach in most cases.

Note that you can also add a total to a chart using chart level scripting - https://community.qlik.com/t5/New-to-Qlik-Sense/Chart-Level-Scripting-Use-Case/td-p/1973024

 

V_Gautam_Raju
Partner - Contributor
Partner - Contributor
Author

Hi Aditya,

I want category wise total

 

Aditya_Chitale
Specialist
Specialist

Hi @V_Gautam_Raju 

Sorry for the late reply. If you want category wise total, you can use the same method mentioned my me earlier. Just concatenate a total flag in the script to your fact table containing Category field and use provided measure expression in your bar chart measure.

Regards,

Aditya

V_Gautam_Raju
Partner - Contributor
Partner - Contributor
Author

Hi Aditya,
I want category wise bar with sum total shown as month.