AVERAGEX using CALCULATE or FILTER, or ALL and ALLEXCEPT.

jsnow123

New Member
Joined
Mar 18, 2015
Messages
4
Firstly, I apologise - I am new to Powerpivot and have tried for a couple of hours to wrap my head around this DAX problem and I cannot afford to waste any more time getting gradually more and more confused. I desperately want somebody to give me a leg-up.

In excel. I am presenting a tables containing data A, B, C... X, Y in a table with slicers on "Type" and "Period". In the same data I am trying to create a permanent measure average of 123, for all the periods selected, without "123" selected in a slicer.

I've got as far this, but cannot figure out how to Average123 across the periods selected, so I'm getting the average across all periods.
Av123:=AVERAGEX(FILTER(ALL(MyTable),[Type]="123"),[Value])​


TypeValuePeriod
A0.11
B101
1231001
C0.12
D102
1231002
X0.13
Y103
1231003

<tbody>
</tbody>



A quick solution to this would be great, then I can trace it back to try to understand how it all works. I am now just too confused to understand what a FILTER, CALCULATE, AVERAGEX, measures, tables

Many thanks
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try This

Code:
CALCULATE( AVERAGEX ( FILTER( MyTable, MyTable[Type] = "123" ), [Sum of Values] ) )
 
Upvote 0
thanks for your response, but I'm afraid that doesn't work. (note, [Sum of Values] was used in place of [Sum of Value])

Av123:=CALCULATE(AVERAGEX(FILTER(MyTable,MyTable[Type]="123"),[Sum of Value]))

1) it doesn't compute a value for Av123 unless the slicer "123" is selected
2) when "123" is selected by slicer, it doesn't compute the total average per period. I have forgot to mention, that each"Period" has multiple rows (Times, below).


Period123Av123(DESIRED Av123)
2
00:00:006.516.516.57
00:00:306.576.576.57
00:01:006.606.606.57
00:01:306.596.596.57
3
00:00:008.388.388.47
00:00:308.498.498.47
00:01:008.498.498.47
00:01:308.518.518.47

<tbody>
</tbody>
 
Last edited:
Upvote 0
Is this what you mean

Code:
=CALCULATE(
    AVERAGEX ( 
        FILTER( MyTable, MyTable[Type] = "123" ), 
        [Sum of Value] ) , 
        ALL( MyTable[Type]
       )
)
 
Upvote 0
Almost... that now gives an average irrespective of whether "123" is selected by the slicer, but has doesn't provide an average for all Times in the Period...

Am I fundamentally doing something wrong? Am I explaining it correctly?

Period123Av123
410.1410.14
00:00:0010.0110.01
00:00:3010.1310.13
00:01:0010.2010.20
00:01:3010.2110.21
510.3310.33
00:00:0010.3210.32
00:00:3010.3410.34
00:01:0010.3310.33
00:01:3010.3310.33

<colgroup><col><col><col></colgroup><tbody>
</tbody>

<colgroup><col><col><col span="2"><col></colgroup><tbody>
</tbody>
 
Upvote 0
Let me try and understand this.

If 123 is selected in the slicer, you want the average of 123 within that period in each row?

If 123 is not selected in the slicer, what do you want to see?

Can you also show some actual data, not just the ave123 or whatever, the actual columns and values including non-123 values, that you have.
 
Upvote 0
Thanks for sticking in there. Let me try and explain it properly.

I'm using slicers to effectively jump between different periods (of time) and present different types of measurement data across the period. I have slicers to also look at different types of data during these periods, but I want to manipulate different types of data differently: e.g. Value, Max(Value), Average(Value). I used the "123" notation to highlight one manipulation option.

I want to use DAX to create a measure of Average Value of Type "123" <type="123">during the sliced period. <time=sliced period="">

Eventually, I don't actually want to see (slice) data type "123": I want to pass it on to another calculation. I'm selecting the slicer "123" to verify the calculation of Average123.

I can post attach a spreadsheet showing real data, in approx 12 hours from now.

I really appreciate your help. I hope it will further my understanding of DAX...</time=sliced></type="123">
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,690
Members
449,117
Latest member
Aaagu

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