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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Average of GroupBy and sum

i have a table with date, status and values(with other column but these are the main ones), its daily data and i would like to have a chart that shows weekly average.
How can i summarize teh data on weekly level. i wnat to group the data based on dates and status and then show the weekly average.
can someone please help me with it.

 

thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

If I understand correctly, the issue is that you want to group the data based on dates. Please try the following methods and check if they can solve your problem:

1.Create the simple table.

vjiewumsft_3-1707206382578.png

 

2.Create the new column.

 

weeknum = WEEKNUM('Table 2'[Date], 2)

 

 

3.Create the new measure to calculate.

 

Measure = CALCULATE(AVERAGE('Table 2'[values]), ALLEXCEPT('Table 2', 'Table 2'[status]), 'Table 2'[weeknum] = MAX('Table 2'[weeknum]))

 

 

4.Select the column chart visual and drag the field to the columns.

vjiewumsft_4-1707206450334.png

 

5.The result is shown below.

vjiewumsft_5-1707206477680.png

 

 

 

Best Regards,

Wisdom Wu

View solution in original post

3 REPLIES 3
saurabhtd
Resolver II
Resolver II

@Anonymous You need to create a calculated column to extract the week of the year from date column present in the table. You can use the following formula:

Week = WEEKNUM(Date, 1)

here I have taken "1" since I am assuming Sunday as the first day of the week. Visit this link for more info on WEEKNUM WEEKNUM – DAX Guide 

DAX formula to calculate weekly average of values column group by week and status

Weekly Average =
VAR _week = SELECTEDVALUE('Table'[Week])
VAR _status = SELECTEDVALUE('Table'[Status])
RETURN
AVERAGEX(
FILTER(
'Table',
'Table'[Week] = _week
&& 'Table'[Status] = _status
),
[Values]
)

Anonymous
Not applicable

@saurabhtd  thanks for reaponding

actually i need it in a stack bar chart where weeks are on x-axis and status is legend 
i created a endofWeek column and using it in x-axis then 
var _sum=sum(values)
return
averagex(selectcolumn(table,"date",table[Date],"status",table[status]),_sum)

this still doesn't give correct result, where am i going wrong

Anonymous
Not applicable

Hi @Anonymous ,

If I understand correctly, the issue is that you want to group the data based on dates. Please try the following methods and check if they can solve your problem:

1.Create the simple table.

vjiewumsft_3-1707206382578.png

 

2.Create the new column.

 

weeknum = WEEKNUM('Table 2'[Date], 2)

 

 

3.Create the new measure to calculate.

 

Measure = CALCULATE(AVERAGE('Table 2'[values]), ALLEXCEPT('Table 2', 'Table 2'[status]), 'Table 2'[weeknum] = MAX('Table 2'[weeknum]))

 

 

4.Select the column chart visual and drag the field to the columns.

vjiewumsft_4-1707206450334.png

 

5.The result is shown below.

vjiewumsft_5-1707206477680.png

 

 

 

Best Regards,

Wisdom Wu

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (26)