simple question on merging powerpivot tables

scooper43

New Member
Joined
May 25, 2012
Messages
7
Hi,

I have been struggling with this for days so I'm hoping someone can help...

I have 2 tables; products and customers. some products go to many customers and some to none so I've created one more table to link products with customers -- basically just a key and a pointer to each table - this table is called prod2cust.

Now I want to create an output table showing all products and the customers for each... I cannot do this

I create my associations and then create a flat pivot. If I simply put in the product name and customer name in the pivot, I get all customers for every product - wrong. Then I tried to denormalize the tables by using the RELATED command and added two new calculated columns on my prod2cust table (one with product name and one with customer name.)

Then when I add only fields from prod2cust into the pivot, it works, except of course, I dont see any of the products that have no customer...

can anyone help?

Steve
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Try putting in Product from the Products table and Customers from the Prod2Cust table.
This assumes that you have a relationship from Prod2Cust[Product] to Products[Product].
 
Upvote 0
I'm definately having a problem, not sure why :confused:-- thanks for your help. Here's what I have done... First, I setup these three tables...


Excel 2010
A
1Products
2A
3B
4C
5D
6E
Sheet1



Excel 2010
D
1Customers
2X
3Y
4Z
Sheet1



Excel 2010
GHI
1Products2CustomersProductCustomer
2QAX
3RBX
4SCX
5TBY
6UEZ
Sheet1


Then I setup relationships so that the Products2Customers table points to both the products and customers tables.

Then I created a pivot with Products from the Products table and Customers from the Products2Customers table. Here's what I get.


Excel 2010
BC
9ProductsCustomer
10AX
11AY
12AZ
13A Total
14BX
15BY
16BZ
17B Total
18CX
19CY
20CZ
21C Total
22DX
23DY
24DZ
25D Total
26EX
27EY
28EZ
29E Total
Sheet1


Its like the relationships are not being setup properly. Any thoughts? Do I need to re-install?

Steve
 
Upvote 0
Thanks,,, so I added a measure:
Number of Deals:=COUNTA(Table3[Products2Customers])

and I get


Excel 2010
BCD
9ProductsCustomerNumber of Deals
10AX1
11BX1
12BY1
13CX1
14EZ1
Sheet1


which is expected behaviour. But when I choose "Show data with no items on rows", I'm back to...


Excel 2010
BCD
9ProductsCustomerNumber of Deals
10AX1
11AY
12AZ
13BX1
14BY1
15BZ
16CX1
17CY
18CZ
19DX
20DY
21DZ
22EX
23EY
24EZ1
Sheet1


This certainly is strange behaviour. So if my measure resulted in no value I only have the choice of not seeing the row or seeing all the rows that are incorrect. I cannot understand this...

thanks for the help
Steve
 
Upvote 0
You can use the following measure to get the output you want. (You get a row for product D.)

Code:
=IF(ISFILTERED(Prod2Cust[Customer]) && COUNTA(Prod2Cust[Customer])=0, BLANK(),1)
<table rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #BBB" cellpadding="2.5px"><colgroup><col style="background-color: #DAE7F5" width="25px"><col><col><col></colgroup><thead><tr style=" background-color: #DAE7F5;text-align: center;color: #161120"><th>
</th><th>B</th><th>C</th><th>D</th></tr></thead><tbody><tr><td style="color: #161120;text-align: center;">3</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">Products</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">Customer</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">M3</td></tr><tr><td style="color: #161120;text-align: center;">4</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">A</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">X</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">1</td></tr><tr><td style="color: #161120;text-align: center;">5</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">B</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-left: 1px solid black;;">X</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-left: 1px solid black;;">1</td></tr><tr><td style="color: #161120;text-align: center;">6</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">B</td><td style="border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">Y</td><td style="text-align: right;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">1</td></tr><tr><td style="color: #161120;text-align: center;">7</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">C</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">X</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">1</td></tr><tr><td style="color: #161120;text-align: center;">8</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">D</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">
</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">1</td></tr><tr><td style="color: #161120;text-align: center;">9</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">E</td><td style="border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">Z</td><td style="text-align: right;border-top: 1px solid black;border-right: 1px solid black;border-bottom: 1px solid black;border-left: 1px solid black;;">1
</td></tr></tbody></table>
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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