cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
giraffesrock
Helper I
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

Hi @giraffesrock ,

 

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)

 

DAX 1.jpg

 

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?

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

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.

View solution in original post

9 REPLIES 9
giraffesrock
Helper I
Helper I

 

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

Hi @giraffesrock ,

 

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.

Hi @giraffesrock ,

 

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)

 

DAX 1.jpg

 

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?

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

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.

View solution in original post

snokku
Helper I
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.

Hi,

 

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

 

 

az38
Super User II
Super User II

Hi @giraffesrock 

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
LinkedIn

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

 

 

 

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

 

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power BI User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

March Update

Check it Out!

Click here to read more about the March 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.