Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

How to add Grand Total for Charts

Hi guys,

I need to add another stacked bar showing the total of the 2 countries added up. Is there a way to do this without writing a measure?

adrianchy_0-1639366843913.png

 


Thank you

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Anonymous 

You need to create a calculated table to add the new row [Total] .

(1)Create a calculated table .

Table 2 = UNION(VALUES('Table'[Country]),ROW("Country","Total"))

Ailsamsft_0-1639537280336.png

(2)Calculate the sum of value grouped by Country .

Measure 1 =
var s = SELECTEDVALUE ( 'Table 2'[Country] )
var t=CALCULATE(SUM('Table'[Value]),'Table'[Country]=s)
RETURN IF (s = "Total",SUM ( 'Table'[Value] ),t)

Ailsamsft_1-1639537280337.png

(3)Add a Stacked Column chart ,put Table 2 [Country] in Axis , Table [Category] in Legend , Table 2 [Measure 1] in Values .

Ailsamsft_2-1639537280338.png

The final result is as shown :

Ailsamsft_3-1639537280340.png

I have attached my pbix file , you can refer to it .

 

Best Regard

Community Support Team _ Ailsa Tao

View solution in original post

@Anonymous ,

Based on Ailsa's solution, I think you need to change your Var t to:

 

VAR t = CALCULATE(SUM(Data[Revenue (Base)]), 'Data'[Country] = s)

 See if that works for you.

Regards,

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous 

You need to create a calculated table to add the new row [Total] .

(1)Create a calculated table .

Table 2 = UNION(VALUES('Table'[Country]),ROW("Country","Total"))

Ailsamsft_0-1639537280336.png

(2)Calculate the sum of value grouped by Country .

Measure 1 =
var s = SELECTEDVALUE ( 'Table 2'[Country] )
var t=CALCULATE(SUM('Table'[Value]),'Table'[Country]=s)
RETURN IF (s = "Total",SUM ( 'Table'[Value] ),t)

Ailsamsft_1-1639537280337.png

(3)Add a Stacked Column chart ,put Table 2 [Country] in Axis , Table [Category] in Legend , Table 2 [Measure 1] in Values .

Ailsamsft_2-1639537280338.png

The final result is as shown :

Ailsamsft_3-1639537280340.png

I have attached my pbix file , you can refer to it .

 

Best Regard

Community Support Team _ Ailsa Tao

Anonymous
Not applicable

I have followed the steps 

Step 1: Create Customized Table

adrianchy_2-1639578663307.png


Step 2: Create Dax Measure

Measure 3 = 

VAR s = SELECTEDVALUE('Grand Total Fix'[Country] )
VAR t = CALCULATE(SUM(Data[Revenue (Base)]), 'Grand Total Fix'[Country] = s)
  
RETURN IF (s = "Total", SUM(Data[Revenue (Base)]),t)  


Step 3:Results ( Adding total works, however there are still duplicates)

adrianchy_3-1639578743310.png

Regards

 

@Anonymous ,

Based on Ailsa's solution, I think you need to change your Var t to:

 

VAR t = CALCULATE(SUM(Data[Revenue (Base)]), 'Data'[Country] = s)

 See if that works for you.

Regards,

Anonymous
Not applicable

I have tried following the post,

however im getting duplicate values

adrianchy_0-1639375353978.png

 

amitchandak
Super User
Super User

@Anonymous , refer this old solution

https://community.powerbi.com/t5/Desktop/Grand-Total-in-Bar-Chart/m-p/612631

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.