Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

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 @Anonymous ,

 

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
Anonymous
Not applicable

 
Anonymous
Not applicable

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

Hi @Anonymous ,

 

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 @Anonymous ,

 

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.

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.

Anonymous
Not applicable

Hi,

 

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

 

 

az38
Community Champion
Community Champion

Hi @Anonymous 

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
Anonymous
Not applicable

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

 

 

 

Anonymous
Not applicable

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.