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
WilliamPH2
Frequent Visitor

AverageX Doesn't seem to be working!

Hi, I'm a relatively new user of DAX, with an insanely simple question. I want to get the average of products at these stores in my sample date. Here's my table:

 

StoreAmountProduct

Store 16Apple
Store 17Oranges
Store 18Pears
Store 19Bananas
Store 110Apple
Store 111Oranges
Store 17Pears
Store 18Bananas
Store 19Apple
Store 110Oranges
Store 120Pears
Store 112Bananas
Store 113Apple
Store 114Oranges
Store 28Pears
Store 29Bananas
Store 210Apple
Store 211Oranges
Store 27Pears
Store 28Bananas
Store 29Apple
Store 210Oranges
Store 250Pears

 

I wrote a measure:

AVERAGEX(VALUES(Table1[Product]),SUM([Amount])

But the pivot table looks like this (see pic below). Why, at the store level does it not iterate over my products and return the average 36 (for Store 1) instead of the sum 144??

 

I am so frustrated by this, and it seems like it should be so basic. I thought AVERAGEX solved all those problems of an average being different for subtotal and total levels, but either that theory is wrong or I'm doing something wrong...

 

Thanks in advance for your help!

 

William

 

My Pivot TableMy Pivot Table

1 ACCEPTED SOLUTION

@WilliamPH2 here is your measure:

 

Avg = AVERAGEX(VALUES(Table4[Product]),CALCULATE(SUM([Amount])))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
WilliamPH2
Frequent Visitor

Note (I can't figure out how to edit this post so I'm just adding this): I want the average of the totals of the products. So in other words, on a product level this measure is pretty much meaningless--I just want, at a store level, so see the number 36 (for store 1) and 30.5 for store 2. And I thought AVERAGEX would get me there with ease... Sadly, I seem to have been mistaken!

@WilliamPH2 here is your measure:

 

Avg = AVERAGEX(VALUES(Table4[Product]),CALCULATE(SUM([Amount])))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Amazing! Thanks so much! I've heard about the thing of using calculate to transition "row context" to "filter context"... is that what is going on here?

 

Again, thanks for helping remove a very frustrating roadblock for me!

 

William

@WilliamPH2 that's exactly what the issue was. glad it worked out.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.

Top Solution Authors