cancel
Showing results for
Did you mean:
Helper I

## DAX - how do I fo this simple thing in DAX.... cell value/average

Hi,

How do I iterate through my table and take each value in that file and compare it to the average of the whole table?

SUMX? Are there other iterative calculation ways?

I just want to have a calculated column with the cell / average for the table * 100....

1 ACCEPTED SOLUTION
Community Support

We can create a new calculate column to meet your requirement.

``````Column =
var cell_ = CALCULATE(SUM('Table'[value]))
var whole_average = AVERAGE('Table'[value])
return
DIVIDE(cell_,whole_average)``````

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?

BTW, pbix as attached.

Best regards,

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

9 REPLIES 9
Helper I

Helper I

Could I do something like SUM(column)/countA or countAX? to get the sum average for the table?

Community Support

How about the result after you follow the suggestions mentioned in my original post?
Could you please provide more details or expected result about it If it doesn't meet your requirement?

Best regards,

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support

We can create a new calculate column to meet your requirement.

``````Column =
var cell_ = CALCULATE(SUM('Table'[value]))
var whole_average = AVERAGE('Table'[value])
return
DIVIDE(cell_,whole_average)``````

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data or describe the fields of each tables and the relations between tables simply?

BTW, pbix as attached.

Best regards,

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helper I

Hi Giraffesrock,

So, to calculate cellvalue/average , can you see if this works?

AverageSalPerWhole = 'Table'[Salary] / AVERAGE('Table'[Salary])

Basically I created a new calculated column.

Thanks,

Sunil.

Helper I

Hi,

This doesn't work. It says a circular dependency is created.... 😞

Super User II

try a column

``````Column =
DIVIDE(
Table[Value],
CALCULATE(AVERAGE(Table[Value]), ALL(Table))
)``````

do not hesitate to give a kudo to useful posts and mark solutions as solution
Helper I

The expresson referes to multiple columns. multiple columns cannot be converted to a sclar value...

Helper I

Thanks! Why am I struggling with DAX so much? I kind of get M and feel more comfortable with it... its more familiar.

What do I need to keep in mind when trying to write DAX?

I need to read some books I think

Announcements