Forum Discussion
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.
| Metric | Region | Date | Value | Plan |
| DL Gross Hours | National | 04/04/2022 | 134,939 | Plan 1 |
| DL Holiday | National | 04/04/2022 | 19,547 | Plan 1 |
| DL Sickness | National | 04/04/2022 | 8,117 | Plan 1 |
| DL Downtime | National | 04/04/2022 | 12,797 | Plan 1 |
| Metric | Region | Date | Value | Plan |
| DL Gross Hours | National | 04/04/2022 | 133,204 | Plan 2 |
| DL Holiday | National | 04/04/2022 | 21,156 | Plan 2 |
| DL Sickness | National | 04/04/2022 | 11,523 | Plan 2 |
| DL Downtime | National | 04/04/2022 | 12,915 | Plan 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
- amitchandakSuper 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])))
- AnonymousNot 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??