PowerPivot Calculated Fields Across Multi Tables + Relationship Creation

Mfrosty

New Member
Joined
May 23, 2012
Messages
15
Happy Holidays Mr.Excel Forums!

The only present I want from Santa this year is the answer to these two problems.. Lame jokes aside, let's begin..

I am creating a dashboard with PowerPivot that is being driven from our MySQL db. Due to issues with the odbc connection driver I decided to store the data locally into excel files and connect powerpivot to that.

My two queries produce the following table structure in PowerPivot:

Table1 -- No unique Columns/Fields
DateWeekMonthQuarterYearClientLine ItemLI IDLI TypeLI PayoutTierImpressionsClicksSpent
12/1/12481242012DogBonez5CPCClicks22,564,15226,45412,382.99
12/1/12481242012CatFishez6CPCClicks1315,56414,5489,549.98
12/2/12481242012DogBonez5CPCClicks21,489,11214,9548,464.57
12/2/12481242012CatFishez6CPCClicks1545,97217,3619,834.11

<tbody>
</tbody>


Table2 -- No unique Columns/Fields
Line ItemLI IDStart DateEnd DateBudgetPayoutPayout PercentFeeGoal
Bonez52/2/1212/3/12$600,000$1.50$5,0001,000,000
Fishez68/9/1212/31/12$400,000$1.12800,000
Bonez512/3/123/1/13$200,000$1.40300,000
Purple72/14/135/1/13$100,000.12$5,000150,000

<tbody>
</tbody>


Table3 -- Unique lookup table to create a relationship between 1 and 2
LI ID
5
6
7

<tbody>
</tbody>



So that's what they look like. Query 1 groups by day & query 2 groups by almost all the fields to capture when a change in a line item occurs (new date, new budget, etc.)

Onto my 1st question..

I tried to create several calculated fields and was being met with this lovely error at every corner:

Code:
Calculation error in measure 'Table1'[Events to Date]: The value for column 'LI Type' in table 'line_item_total' cannot be determined in the current context. Check that all columns referenced in the calculation expression exist, and that there are no circular dependencies. This can also occur when the formula for a measure refers directly to a column without performing any aggregation--such as sum, average, or count--on that column. The column does not have a single value; it has many values, one for each row of the table, and no row has been specified.

For example I was trying to create a calculated field that would show the "events to date":

Code:
=IF(Table1[LI Type]= "percent", sum(daily[Spent])*(1+Table2[Payout Percentage]),IF(Table1[LI Type]= "CPC", sum(Table1[Clicks]), if(Table1[LI Type]= "CPF", sum(Table1[Connections]))))

I was reading through misc. forums about creating a new calculated field for each calculation first and wrapping it in 'CALCULATE()', but I didn't have any luck with that either. What am I missing here?



Onto my 2nd question..

What additional relationships or tables do I need to add so that I can create a PivotTable that combines Tables 1 & 2?
Example:
ClientLI IDLI TypeLI PayoutTierBudgetPayoutPayoutPercentFeeGoalStartDateEndDateImpressionsClicksSpent
Dog5CPCClicks2200,0001.40300,00012/3/123/1/131,489,11214,9548,464.57

<tbody>
</tbody>

And ultimately be able to splice this data by the Table 1 date field so I can see the line item progress over time.

Some material I read that "may" have my answer hidden in it: User-Friendly Report Sorting With Slicers! « PowerPivotPro

Sorry for the long post, and thanks in advance for any help/insights!
 
Sure thing Miguel. Give me a few to get it organized. Just got home from work. I will pm you the dropbox link.
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,215,174
Messages
6,123,454
Members
449,100
Latest member
sktz

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