Forum Discussion
Total Column in a Clustered Bar chart
- Anonymous2 years ago
Hi Anonymous
You can refer to the following example
Sample data
1.Create a new Type table
Type = var a=SUMMARIZE('Table','Table'[Year_Month]) var b={"Total"} return UNION(a,b)2.Then create a measure to calculate the sum
Sum = VAR a = SUMMARIZE ( FILTER ( 'Type', [Year_Month] <> "Total" ), [Year_Month] ) RETURN CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Year_Month] IN a )3.Then create a measure
Sum_display = VAR a = SUMMARIZE ( ALLSELECTED ( 'Type' ), [Year_Month], "Sum", [Sum] ) RETURN IF ( SELECTEDVALUE ( 'Type'[Year_Month] ) = "Total", SUMX ( a, [Sum] ), [Sum] )4.Put the column of type table and the sum_display measure to the visual
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
You can refer to the following example
Sample data
1.Create a new Type table
Type = var a=SUMMARIZE('Table','Table'[Year_Month])
var b={"Total"}
return UNION(a,b)
2.Then create a measure to calculate the sum
Sum =
VAR a =
SUMMARIZE ( FILTER ( 'Type', [Year_Month] <> "Total" ), [Year_Month] )
RETURN
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Year_Month] IN a )
3.Then create a measure
Sum_display =
VAR a =
SUMMARIZE ( ALLSELECTED ( 'Type' ), [Year_Month], "Sum", [Sum] )
RETURN
IF ( SELECTEDVALUE ( 'Type'[Year_Month] ) = "Total", SUMX ( a, [Sum] ), [Sum] )
4.Put the column of type table and the sum_display measure to the visual
Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for providing the example and steps you've taken to create a clustered column chart with a total bar in Power BI. It looks like you've already created the necessary measures and set up your visual correctly. Here's a summary of the steps you've taken:
- Created a new table called "Type" with a "Total" category.
- Created a measure called "Sum" to calculate the sum of values excluding the "Total" category.
- Created a measure called "Sum_display" to display the sum values and handle the "Total" category separately.
- Placed the "Type" table and the "Sum_display" measure in the visual.
Your output appears to be a clustered column chart with the "Total" bar included, which is exactly what you were looking for. This approach is common in Power BI for displaying a total bar in a clustered column chart.
If you have any specific questions or need further assistance with this Power BI setup, please feel free to ask, and I'll be happy to help.