Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
tony_tohme
New Member

Stacked Chart from 2 tables

Hi there,

I have 2 simple tables

Table 1

YearMonthAllocated Resources
202168
202172
202143

 

And Table 2

YearMonthHired
202124
202162
202131

 

How can I represent these 2 tables in one chart side by side compare grouped by month?

When I add one table it works and show the breakdown by month, but when I add the second table  'Hired' as values it sums up the values and does it break it down beside the first data.

 

Your input is much appreciated.

thank you

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @tony_tohme ,

The final output refer:

vluwangmsft_0-1642751440824.png

 

create the column on the two table:

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

vluwangmsft_1-1642751476752.png

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

vluwangmsft_2-1642751500648.png

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]
        )
    )
)

vluwangmsft_3-1642751560963.png

 

Relationship like below:

vluwangmsft_4-1642751583080.png

 

Then create the visual:

vluwangmsft_5-1642751609851.png

 

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


Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @tony_tohme ,

The final output refer:

vluwangmsft_0-1642751440824.png

 

create the column on the two table:

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

vluwangmsft_1-1642751476752.png

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

vluwangmsft_2-1642751500648.png

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]
        )
    )
)

vluwangmsft_3-1642751560963.png

 

Relationship like below:

vluwangmsft_4-1642751583080.png

 

Then create the visual:

vluwangmsft_5-1642751609851.png

 

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


Best Regards

Lucien

amitchandak
Super User
Super User

@tony_tohme , Either create a common month year table or Date table and join with that and analyze other 

In both table you can have one of the column

Month Year = [Year]*100 +[Month]

 

or

 

Date = date([year],[month],1)

 

Join both with date table to month year and use that for analysis 

 


To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.