aggregating data in two different PowerPivot tables in one Pivot Table

jameddelaney

New Member
Joined
Jan 28, 2012
Messages
2
I have two PowerPivot tables:
1) AgentTimeData

  • Data source: mysql
    • Data description: There is a row in this table for each transition a representative makes. So as a representative transitions from the statuses “waiting for a call” to “talking” to “wrap up” to “waiting for a call” again, 4 entries in this table are created in this table
    • Columns
      • AgentUserName
      • Status
      • StartDateTime
      • DurationOfTimeInStatus
    • Calculated Columns
      • StartDayYYYMMDD
      • keyAgentTimeDataAdjustments: a concatenated sting of AgentUserName, Status & StartDayYYYYMMDD
2) AgentTimeDataAdjustments

  • Data source: linked excel table
  • Data Description: Sometimes the data that we get from the database isn’t 100% accurate. For example, a representative will forget to log out of their workstation at the end of the day and because the agent software doesn’t have a good auto log out feature or permit time in status adjustments to be made w/in the application we need this table to record those adjustments. For now all adjustments are negative (will reduce the time in status)
  • Column
    • AgentUserName
    • Status
    • DateOfAdjustment
    • DurationOfAdjustment
  • Calculated Columns
    • DateOfAdjustmentYYYMMDD
    • keyAgentTimeData: a concatenated sting of AgentUserName, Status & DateOfAdjustmentYYYYMMDD


I am using the key fields to join these two tables together. I’d like to create a PivotTable from this PowerPivot data that will show me a list of AgentUserNames down the left and Statuses across the top and a the DurationAdjusted where DurationAdjusted will sum up all of the respective rows from the AgentTimeData and subtract the respective rows from the AgentTimeDataAdjustment table.


So far I have created a DAX measure that doesn’t accomplish this task. It looks like this:


=sum(AgentTimeData[DurationOfTimeInStatus]) – sum(AgentTimeDataAdjsutments[DurationOfAdjustment])


Can someone please tell me what I am doing wrong?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Can you specify what you mean when you say it's not working? Are you getting an error? Or incorrect results in the pivot? And if incorrect results, please give us an idea of what the incorrect results are (and what a correct result would look like).
 
Upvote 0
my conclusion is that it is a bad "join" meaning a many to one join. this spreadsheet illustrates my point:
https://skydrive.live.com/#!/view.aspx?cid=CA968D3A3282B922&resid=CA968D3A3282B922!493

on the "AgentTimeData" tab swap the "Sample data that creates a bad join into the "AgentTimeData" excel table and refresh the "PowerPivotAnalysis" tab. you will then see the error.

to fix this i was going change AgentTimeDataAdjustment[DateOfAdjustment] to AgentTimeDataAdjustment[DateTimeOfAdjustment] to make the join a one to one join.

unless someone else had some other thoughts...
 
Upvote 0
OK I have looked at the xlsx and I think what you need more than anything is a third table. Maybe even a fourth.

Whenever you have two or more "fact" tables - tables contain measurements or sales or anything else you want to write measures against - you generally cannot do what you need to do unless you add separate "master filter" tables.

This happens to be illustrated in a recent blog post:

http://www.powerpivotpro.com/2012/01/data-of-different-grains-a-followup/

I think what you ultimately will need to do, after introducing one or more filter tables, is write measures against each of your two fact tables ("AgentTime" measures and "Adjustment" measures). And then you can write new measures that add together measures from each fact table ([Agent Time] - [Adjusted Time]) to get the desired results.
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,106
Members
452,302
Latest member
TaMere

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