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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Fusilier
Helper III
Helper III

Clustered bar chart with a total column

Hi,

I currently have this bar chart:

bar chart.png 

The orange bar is total company, the green bars are for each department.

It is currently an illusion though, as it is simply two different charts positioned side by side.

Is it possible to create a single chart that displays a total bar as well as individual bars?

2 ACCEPTED SOLUTIONS
Daniel29195
Super User
Super User

@Fusilier 

yes you can

add to your dimension table  a total row. (this way the total will be displayed ). 

 

then in you measure write an swtich statement  : 

m= 

var  total = calculate ( [sales amount]) , removefilters( dim[name]))

var current = [sales amount]

return switch(

true () , 

selectedvalue(dim[name] = "Total"  total , 

current

)

 

hope this helps. 

 

Note :
create variables 

View solution in original post

shafiz_p
Resident Rockstar
Resident Rockstar

Hi @Fusilier  This is possible to acheive. To show total in clustered bar/column chart follow the steps.

1. First create a table with distinct category, for your case department and add total row with it. You can use union function. For example, I have used region :

All_Region = UNION(DISTINCT('Sales Territory'[Sales Territory Region]), {"All Region"})

 

2. Create a relationship one to many with the original dimension table. See image below:

shafiz_p_0-1726388380851.png

 

3. Create a measure to evaluate Totals for all category and individual category. See example :

Total_Sales_All_Region = 
VAR _total = CALCULATE([Total Sales], ALL(All_Region[Sales Territory Region]))

VAR _result = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(All_Region[Sales Territory Region]) = "All Region", _total, [Total Sales]
)

RETURN
_result

 

4. Now you can create column or bar chart using the newly created column and measure. See Image below:

shafiz_p_1-1726388646084.png

 

Hope this helps!!

If, Please accept it as a solution!!


Best Regards,
Shahariar Hafiz

View solution in original post

2 REPLIES 2
shafiz_p
Resident Rockstar
Resident Rockstar

Hi @Fusilier  This is possible to acheive. To show total in clustered bar/column chart follow the steps.

1. First create a table with distinct category, for your case department and add total row with it. You can use union function. For example, I have used region :

All_Region = UNION(DISTINCT('Sales Territory'[Sales Territory Region]), {"All Region"})

 

2. Create a relationship one to many with the original dimension table. See image below:

shafiz_p_0-1726388380851.png

 

3. Create a measure to evaluate Totals for all category and individual category. See example :

Total_Sales_All_Region = 
VAR _total = CALCULATE([Total Sales], ALL(All_Region[Sales Territory Region]))

VAR _result = 
SWITCH(
    TRUE(),
    SELECTEDVALUE(All_Region[Sales Territory Region]) = "All Region", _total, [Total Sales]
)

RETURN
_result

 

4. Now you can create column or bar chart using the newly created column and measure. See Image below:

shafiz_p_1-1726388646084.png

 

Hope this helps!!

If, Please accept it as a solution!!


Best Regards,
Shahariar Hafiz

Daniel29195
Super User
Super User

@Fusilier 

yes you can

add to your dimension table  a total row. (this way the total will be displayed ). 

 

then in you measure write an swtich statement  : 

m= 

var  total = calculate ( [sales amount]) , removefilters( dim[name]))

var current = [sales amount]

return switch(

true () , 

selectedvalue(dim[name] = "Total"  total , 

current

)

 

hope this helps. 

 

Note :
create variables 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.