Forum Discussion
Average by column
Hi Experts,
How to calculate the average per a certain column
for example, as per the below table
end result should be (2+6+9)/3
ColumnA ColumnB
X 2
X 2
Y 6
Y 6
Z 9
Z 9
Thanks in advance
Anonymous
try this:
Average distinct = AVERAGEX (DISTINCT('Table'),[ColumnB])Table :
Output:
Click here to see more details about DISTINCT.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your Kudos !!
7 Replies
- VahidDMSuper User
Hi Anonymous
Try this measure:
Average distinct = AVERAGEX ( DISTINCT ( 'Table'[ColumnB] ), [ColumnB] )Output:
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your Kudos !!
- AnonymousNot applicable
this wont work if I have the below table
as it will be (2+2+6+9)/4
ColumnA ColumnB
M 2
X 2
X 2Y 6
Y 6
Z 9
Z 9- ryan_mayuSuper User
Anonymous
pls try this
MEASURE = var tbl=SUMMARIZE('Table (2)','Table (2)'[ColumnA],"columnB",AVERAGE('Table (2)'[ColumnB])) return AVERAGEX(tbl,[columnB])
- ziyabikram96Helper V
- AnonymousNot applicable
Hi Anonymous ,
You can create a measure as below to get it:
Measure = VAR _tab = DISTINCT ( ALLNOBLANKROW ( 'Table'[ColumnA], 'Table'[ColumnB] ) ) RETURN AVERAGEX ( _tab, [ColumnB] )Best Regards