Dax Measure to Average Two Measures

bravo1563

New Member
Joined
Dec 25, 2013
Messages
20
Hello,I have a PowerPivot dataset for Football stats in which I have two measures created “RecYdsDomPct” and “RecTDDomPct” that I want to average together. The average of these should be 35.17%. However when I remove any of my other fields (day and game id) the percentages do not tie back to 35.17%. I’ve tried a Sumx formula but did not get the right result.
Any help would be great!
Link to file…https://www.dropbox.com/s/q6duddema3o0izj/CFB PlayerGameStats.xlsx?
I’ve attached the way it should really calculate so you can see what I’m trying to get.
Thanks!
[h=6]Attachments:[/h]
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
You are correct that you need to use an Iterator (like SUMX or AVERAGEX). The problem you are experiencing is due to the way Power Pivot works. Power Pivot first applies filters from the pivot table (initial filter context), then does the calculation. Each row in your pivot table is filtered for one game, and hence the % calculations are done on the stats for that single game. When you get to the grand total row, the data from all games is combined before doing the calculation and hence instead of getting the result of each game calculated individually and then averaged, you get all the stats from all games aggregated and then averaged as if it were a single game.

When ever you see this, you need to think about how you can simulate what the pivot table is doing. From what I can see, the pivot table is iterating over each game, one at a time to do a game by game calculation. To simulate that using an iterator, you need to produce a temp table that will give you the list of all the games. You can use Values for that. Values will pick up the list of games that are in your current filter context (so no need for allselected).

So this should work

Code:
Average Works:=AVERAGEX(values(tblGames[GameID]),[mRecDomPct])
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,447
Members
452,327
Latest member
kris9926

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