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
Pandadev
Post Prodigy
Post Prodigy

Get weekly average of totals even when some daily data is missing

I am trying to find a dax solution to help with some daily metrics I receive.

The issue I have is that sometimes there can be an issue with data not being received on some days.

I want to get the average weekly value.

Example of data

 

Name - Rows - Date

AA         24        04/01/2021

AA         28        05/01/2021

AA         21        06/01/2021

AA         27        07/01/2021

AA         23        08/01/2021

AA         24        09/01/2021

So for the week commencing mon 04/01 to Sun 10/01 there are 6 days of data total value of rows divided by 6 = 24.5

BB         24        04/01/2021

BB         28        05/01/2021

BB         21        06/01/2021

BB         24        09/01/2021

 

In the above example BB has data missing for 07/01 , 08/01 , 10/01 so it would be 97 divided by 4 , avg 24.25

 

So is there a dax measure / formula that can workout the week range to look at dates , and then count the dates for each name and get the correct average . Any help would be very much appreciated. Thanks

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Pandadev ,

 

Create a weeknum column.

weeknum = WEEKNUM('Table'[Date])

Then refer the following formula.

Column = 
var _count = CALCULATE(DISTINCTCOUNT('Table'[Date]),ALLEXCEPT('Table','Table'[Name],'Table'[weeknum]))
var _sum = CALCULATE(SUM('Table'[Rows]),ALLEXCEPT('Table','Table'[Name],'Table'[weeknum]))
return
_sum/_count

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

1 REPLY 1
v-jayw-msft
Community Support
Community Support

Hi @Pandadev ,

 

Create a weeknum column.

weeknum = WEEKNUM('Table'[Date])

Then refer the following formula.

Column = 
var _count = CALCULATE(DISTINCTCOUNT('Table'[Date]),ALLEXCEPT('Table','Table'[Name],'Table'[weeknum]))
var _sum = CALCULATE(SUM('Table'[Rows]),ALLEXCEPT('Table','Table'[Name],'Table'[weeknum]))
return
_sum/_count

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

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.