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.
Any idea how to get this to sort correctly when working with a full year since you'll have 2023-1 and 2023-10 and BI will format the "Year_Month" column in the "Type" table as text? Also, if it could be scalable to include future years, that would wonderful. Great solution otherwise though!