Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Total Column in a Clustered Bar chart

Hi, To get a Total Bar in a clustered column chart. Need a total bar along with the four bars as shown in the below image. Thanks in advance.
  • Anonymous's avatar
    Anonymous
    2 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.