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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sfink22
Helper I
Helper I

Stacked column chart with data from two tables

I have two tables that I am trying to graph on one stacked column chart. One dynamic table contains dates for existing project phases, and one is a data table that contains % time to complete the phase based on complexity (that does not change).

 

For example, the project phase/date table would look like this:

IndexProjNameOwnerComplexity RatingPhase 1 DatePhase 2 Date... (etc.)
1AbcBob42020P042020P05
2DefJill22020P012020P02
3GhiFred12020P092020P10

 

And the % time for completion would look like this:

ComplexityPhase 1 TimePhase 2 TimePhase 3 TimePhase 4 TimePhase 5 Time
1.05.1.15.2.1
2.1.15.2.25.15
3.3.35.4.5.3

 

I'm trying to create a "schedule" of sorts that shows the spread of work over time, that I could then add a slicer to in order to look at each project owner individually (they can own multiple projects per person). I need the dates to go on the x-axis and the sums of % time to go on the y-axis. The chart should look like this:

Capture.JPG

 

The "dates" are categorical values and not actual calendar dates, and they must remain this way as this is how it comes out of our system. The "0" added in for single digit periods (P01, P02 vs. P10) is necessary to get the categorical values to line up correctly on the graph's axis.

 

I've tried many ways to link the tables, but currently all I get is the same sums for each phase across all dates i.e. the same bars on every x-axis value. My trouble in linking comes because I don't have any way to link the dates. There could be any year/period combo across three years, but some dates may not show up if none of the phases align with that date. So in order to have dates on the x-axis, I have to add one of the phases, but it doesn't necessarily align with all dates from the other projects or phases. In other words, the x-axis can't be linked between the two tables. 

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

Hi @sfink22 ,

 

You can do like this.

1. Get such a table by transforming(copy + append queries)

nn6.PNG

2. Create table relationship.

nn7.PNG

3. Create calculated columns in [Date] table.

P1_time = 
LOOKUPVALUE(
    '%time'[Phase 1 Time],
    '%time'[Complexity], 'Date'[Complexity Rating]
)
P2_time = 
LOOKUPVALUE(
    '%time'[Phase 2 Time],
    '%time'[Complexity], 'Date'[Complexity Rating]
) 

4. Add the calculated columns and the [Date] column to the visual.

nn8.PNG

 

Best regards,
Lionel Chen

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

 

View solution in original post

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @sfink22 ,

 

You can do like this.

1. Get such a table by transforming(copy + append queries)

nn6.PNG

2. Create table relationship.

nn7.PNG

3. Create calculated columns in [Date] table.

P1_time = 
LOOKUPVALUE(
    '%time'[Phase 1 Time],
    '%time'[Complexity], 'Date'[Complexity Rating]
)
P2_time = 
LOOKUPVALUE(
    '%time'[Phase 2 Time],
    '%time'[Complexity], 'Date'[Complexity Rating]
) 

4. Add the calculated columns and the [Date] column to the visual.

nn8.PNG

 

Best regards,
Lionel Chen

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

 

Greg_Deckler
Super User
Super User

So are the tables supposed to be related on Complexity?

 

I would unpivot the % columns in your second table. Create a bridge table of distinct Complexity values. Create relationships on complexity columns, use the complexity column from your bridge table.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Yes, they are related by complexity. By a bridge table, do you mean a table that has a single column with the unique complexity values? 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.