Forum Discussion

LeaRupnik's avatar
LeaRupnik
Helper III
6 years ago

Line chart line and legend

Hello

I would like to draw a bar graph with a legend from different groups. With the hierarchy of data and the sum total. 

This three graph in one.

thenks

 

Lp

LEa

2 Replies

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Community Support

    Hi,

     

    According to your description, I create a table to test:

    Please take following steps:

    1)Create a calculated table:

    Table = UNION(ADDCOLUMNS(DISTINCT('Test'[Location]),"Level","Location"),ADDCOLUMNS(DISTINCT('Test'[OrderID]),"Level","OrderID"),ADDCOLUMNS(DISTINCT('Test'[Product]),"Level","Product"))

    And it shows:

    2)Create a measure to calculate the [Amout] by three levels:

    Measure =

    CALCULATE (

        SUM ( Test[Amout] ),

        FILTER (

            Test,

            SWITCH (

                SELECTEDVALUE ( 'Table'[Level] ),

                "Product", 'Test'[Product] = SELECTEDVALUE ( 'Table'[Element] ),

                "Location", 'Test'[Location] = SELECTEDVALUE ( 'Table'[Element] ),

                "OrderID", 'Test'[OrderID] = SELECTEDVALUE ( 'Table'[Element] )

            )

        )

    )

    3)The result shows:

    You can also use ‘Table’[Level] as a slicer to filter the above visual:

    Here is my test pbix file:

    pbix 

     

    Best Regards,

    Giotto Zhi