Combine two tables - PowerPivot

sbawnh

Board Regular
Joined
Feb 25, 2019
Messages
50
Office Version
  1. 365
Platform
  1. Windows
HI,

I have Table1 and Table2 in a power pivot data model. I can show all of Table 1, but only just "Cat" from Table2. Is there anyway to show Turtle when Table1 is the Primary?


Table1
AnimalJanuary
Dog
1​
Cat
1​


Table2
AnimalJuly
Cat
1​
Turtle
1​


PowerPivot

AnimalJanuaryJuly
Dog
1​
0​
Cat
1​
1​


What I want

AnimalJanuaryJuly
Dog
1​
0​
Cat
1​
1​
Turtle
0​
1​
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
I would upload both tables to power query,append them (then group by Animal if you want 2 cats in January)
 
Upvote 0
Create the two tables:
Book1
ABCDE
1AnimalJanuaryAnimalJuly
2Dog1Cat1
3Cat1Turtle1
Sheet1

And bring them both into Power Query - right click anywhere in each table and select Get Data from Table/Range. Load them both as Connection Only.
From the Data menu select Get Data -> Combine Queries -> Append. That will create this table in Power Query - shown here for information:
Book1
LMN
1AnimalJanuaryJuly
2Dog1
3Cat1
4Cat1
5Turtle1
Sheet1

The problem is that the data isn't laid out properly. In the Power Query editor, right click on the Animal and select Unpivoted Other Columns. That will result in a table like this:
Book1
LMN
1AnimalAttributeValue
2DogJanuary1
3CatJanuary1
4CatJuly1
5TurtleJuly1
Sheet1

You can easily rename the columns in the Power Query editor to something like Month and Count.
After unpivoting and renaming the columns, Load To a PivotTable Report.
Put the Animal column into Rows, Month into Columns, and Count into Values. That will give you the Pivot Table you're looking for:
Book1
GHIJ
1Sum of CountColumn Labels
2Row LabelsJanuaryJulyGrand Total
3Cat112
4Dog101
5Turtle011
6Grand Total224
Sheet1

The only significant change I made was to the Pivot Table Options which was to specify displaying 0 for empty cells.
 
Upvote 1
Solution

Forum statistics

Threads
1,223,952
Messages
6,175,596
Members
452,657
Latest member
giadungthienduyen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top