Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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.  

 

 

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

2 Replies

  • 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's avatar
      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??