Forum Discussion

Guneet_B21's avatar
Guneet_B21
Helper II
3 years ago
Solved

adding 2 bars

Hi everyone, i am looking for help with an issue im facing, i have 3 types of product which i need to show the bar chart for. but i also need to show the total of all the columns (which i was able...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Guneet_B21 ,

     

    I think there should be a [Type] column and a [Cal] column in your table. We need to create a table with all data you need and add the column into X aixs. 

    Here I create an easy sample to have a test.

    Data table:

    X axis table:

    X axis = UNION(VALUES('Table'[Type]),{"Total","ff+ts"})

    Relationship:

    Measure:

    Measure = 
    VAR _Cal =
        SUM ( 'Table'[Cal] )
    VAR _Total =
        CALCULATE ( SUM ( 'Table'[Cal] ), ALLSELECTED ( 'Table' ) )
    VAR _ffandts =
        CALCULATE (
            SUM ( 'Table'[Cal] ),
            FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Type] IN { "ff", "ts" } )
        )
    RETURN
        IF (
            ISBLANK ( _Cal ),
            SWITCH ( SELECTEDVALUE ( 'X axis'[Type] ), "Total", _Total, "ff+ts", _ffandts ),
            _Cal
        )

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.