Forum Discussion

tony_tohme's avatar
tony_tohme
New Member
4 years ago
Solved

Stacked Chart from 2 tables

Hi there, I have 2 simple tables Table 1 Year Month Allocated Resources 2021 6 8 2021 7 2 2021 4 3   And Table 2 Year Month Hired 2021 2 4 2021 6 2 2021...
  • v-luwang-msft's avatar
    4 years ago

    Hi tony_tohme ,

    The final output refer:

     

    create the column on the two table:

    yearmonth = 'Table'[Year]&""&'Table'[Month]

    Column = 'Table (2)'[Year]&""&'Table (2)'[Month]

    Then create the below table:

    Table3 =
    DISTINCT (
        UNION (
            SELECTCOLUMNS (
                'Table',
                "year", 'Table'[Year],
                "month", 'Table'[Month],
                "my", 'Table'[yearmonth]
            ),
            SELECTCOLUMNS (
                'Table (2)',
                "year", 'Table (2)'[Year],
                "month", 'Table (2)'[Month],
                "my", 'Table (2)'[Column]
            )
        )
    )

     

    Relationship like below:

     

    Then create the visual:

     

    Did I answer your question? Mark my post as a solution!


    Best Regards

    Lucien