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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mweber
Frequent Visitor

How to get correct averages using SUMMARIZE or GROUPBY

Hello,

 

I'm relatively new to DAX and am having trouble getting the correct averages from a dataset. Here's a subsection of a datset I'm working with:

Week EndingSiteSKU NbrUnits
1/6/2019Sycamore10023515664680
1/6/2019Sycamore100276536334260
1/6/2019Sycamore1002596200128
1/6/2019Sycamore1003232393700
1/6/2019Sycamore20758529700
1/6/2019Sycamore10010752123392
1/6/2019Sycamore10027654661408
1/6/2019Sycamore10027654691728
1/6/2019Sycamore10018694861595
1/6/2019Sycamore1003229847580
1/6/2019Sycamore1003229848144
1/6/2019Sycamore10016550653072
1/6/2019Sycamore10027653534048
1/6/2019Sycamore10027653583300
1/6/2019Sycamore10012402153328
1/6/2019Sycamore1003115503576
1/6/2019Kingman1001869486935
1/6/2019Kingman20758510116
1/6/2019Kingman10012402152756
1/6/2019Kingman10010752121056
1/13/2019Sycamore20758556736
1/13/2019Sycamore100107521226160
1/13/2019Sycamore10023515668460
1/13/2019Sycamore100276535813464
1/13/2019Sycamore100276546917832
1/13/2019Sycamore100186948618920
1/13/2019Sycamore100276536355050
1/13/2019Sycamore100124021528392
1/13/2019Sycamore1003232393904
1/13/2019Sycamore1003229847488
1/13/2019Sycamore1002765466656
1/13/2019Sycamore10016550652496
1/13/2019Sycamore1002765353880
1/13/2019Sycamore10031155031392
1/13/2019Sycamore1003229848180
1/13/2019Sycamore1002596200128
1/13/2019Kingman100124021515184
1/13/2019Kingman100107521212880
1/13/2019Kingman10018694863960
1/13/2019Kingman2075854356
1/20/2019Sycamore100235156610820
1/20/2019Sycamore100107521227680
1/20/2019Sycamore100276546913736
1/20/2019Sycamore20758555548
1/20/2019Sycamore100276535813728
1/20/2019Sycamore10031155032592
1/20/2019Sycamore1003232393228
1/20/2019Sycamore10027653532552
1/20/2019Sycamore100322984776
1/20/2019Sycamore100186948614410
1/20/2019Sycamore100276536325800
1/20/2019Sycamore100322984818
1/20/2019Sycamore10027654661200
1/20/2019Sycamore100124021525896
1/20/2019Sycamore10016550654064
1/20/2019Kingman100107521220928
1/20/2019Kingman10018694869625
1/20/2019Kingman100124021522620
1/20/2019Kingman20758549896

What I'm trying to accomplish is to simply get the Average Weekly Units for each SKU Nbr. I've tried quite a few methods... measures, columns... average x, Summarize, Group by, etc... I  can't get the correct averages for each SKU. In excel, all you have to do is create a pivot on week ending, sum up the SKU, and see what the average is across all weeks. (e.g. the answer for 207585 is 68,784/week) I can't seem to replicate this using DAX. Any help would be greatly appreciated. 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @mweber ,

 

Try this measure:

 

Average per week = SUM('Table'[Units]) / CALCULATE(DISTINCTCOUNT('Table'[Week Ending]))

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
AlB
Super User
Super User

Hi @mweber 

Try this:

1. Place Table1[SKU Nbr] in the rows of a matrix visual

2. Create this measure and place it in the visual:

Measure =
DIVIDE ( SUM ( Table1[Units] ); DISTINCTCOUNT ( Table1[Week Ending] ) )
MFelix
Super User
Super User

Hi @mweber ,

 

Try this measure:

 

Average per week = SUM('Table'[Units]) / CALCULATE(DISTINCTCOUNT('Table'[Week Ending]))

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



mweber
Frequent Visitor

MFelix,

 

That worked! I've literally been beating my head against the wall for a few days on that one 🙂 I knew it was probably an easy solution but am just starting to get comortable with how calculate works.  Another question but on the same dataset:

 

How then to get the standard deviation of that result. Said another way, what is the Standard Deviation of the SKU across weeks.

 

MWeber

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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