Forum Discussion
Calculate Mean based on 1 column
Hi PBI Professionals.
I'm having a difficult time trying to get the Mean value based on 1 column.
below is what I currently have:
Day | Cellname | Cell1 | Total days | Mean cell1 |
25 | Cell1 | 1466 | 5 | 293.2 |
26 | Cell1 | 1525 | 5 | 305.00 |
27 | Cell1 | 1455 | 5 | 291.0 |
28 | Cell1 | 1862 | 5 | 372.4 |
29 | Cell1 | 2132 | 5 | 5426.4 |
30 | Cell1 | 855 | 5 | 171.0 |
What I'm trying to achieve is for the column "Mean cell1" to be the mean fro all values in cell1 not per row. ie. (1466+1525+1455+1862+2132+855)/5
I just need a calculated column with this value or even a measure will do
Hi Anonymous,
I suggest you try to use measure to calculate the sum of [Cell count] instead of a calculated column, due to the calculated column is evaluated for each row in your table, immediately after you hit 'Enter' to complete the formula and will be saved back into the model as a fixed value, you could refer to this blog:
https://projectbotticelli.com/knowledge/dax-calculated-columns-vs-measures-video-tutorial
Regards,
Daniel He
4 Replies
- deldersveld
Resident Rockstar
If I understand your intent correctly, you should be able to create a new measure with the formula AVERAGE(Table[Cell1]).
- v-danhe-msft
Microsoft Employee
Hi Anonymous,
Based on my test, you could refer to the deldersveld function and I have tested, it could work:
Also, you could use the measure to get the result:
Measure = AVERAGEX(ALL(Table1),'Table1'[Cell1])
Hope it could help you.
Regards,
Daniel He
- AnonymousNot applicable
Hi v-danhe-msft, deldersveld,
Sorry I think I didnt give you the full information.
To attain Cell Count the following calculated column was created:
Sum Count = SUM('Sheet Append'[Cell Count])however when I use a slicer user name it doesn change the sum count value.
If i can get this column to reflect the changes of the slicer then i would think it would be easy to get the mean out
My original data sheet looks like this:
- v-danhe-msft
Microsoft Employee
Hi Anonymous,
I suggest you try to use measure to calculate the sum of [Cell count] instead of a calculated column, due to the calculated column is evaluated for each row in your table, immediately after you hit 'Enter' to complete the formula and will be saved back into the model as a fixed value, you could refer to this blog:
https://projectbotticelli.com/knowledge/dax-calculated-columns-vs-measures-video-tutorial
Regards,
Daniel He