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
Anonymous
Not applicable

Creating a stacked chart from two separate tables

Morning I am trying to create a stacked bar chart, using data from two different tables.  But I am having trouble getting it in the format that I need. I have attached some sample data and below is a copy of the graph I am after and the graph I am gettiing.  Any help would be great.  

I have gone down the approach of using seperate tables, so it allows me to use a slicer for each plan as I will have muliple plans to compare.  so when I import the data I use power query, to merge all the plans and then duplicate the table,   hope this all makes sense.  

 

wortandy_0-1650528932112.png

 

sorry cant work out how to attach something here, so have added the below.

 

MetricRegionDateValuePlan
DL Gross HoursNational04/04/2022134,939Plan 1
DL HolidayNational04/04/202219,547Plan 1
DL SicknessNational04/04/20228,117Plan 1
DL DowntimeNational04/04/202212,797Plan 1
     
MetricRegionDateValuePlan
DL Gross HoursNational04/04/2022133,204Plan 2
DL HolidayNational04/04/202221,156Plan 2
DL SicknessNational04/04/202211,523Plan 2
DL DowntimeNational04/04/202212,915Plan 2
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Create common dimensions Plan and metric and join them with your tables, and use in visual

 

Metric= distinct(union(distinct(Table1[Metric]),distinct(Table2[Metric])))

 

Plan= distinct(union(distinct(Table1[Plan]),distinct(Table2[Plan])))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Create common dimensions Plan and metric and join them with your tables, and use in visual

 

Metric= distinct(union(distinct(Table1[Metric]),distinct(Table2[Metric])))

 

Plan= distinct(union(distinct(Table1[Plan]),distinct(Table2[Plan])))

Anonymous
Not applicable

Thanks for this, I should have said I am new to PBI so not really sure what I do with the above.  I assume they are measures??

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.