cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

How do you calculate the rolling average per week/month?

I have bins created from my date field which gets the daily group.

Is there a way to calculate the weekly average, so for example from April 1st to April 7th it should have an average of 16.2 (excludes cells containing 0).

So for an output I am looking for it to show Week Commencing April 1st then display the average of 16.2, then Week Commencing April 8th to display 27, and so forth.

1 ACCEPTED SOLUTION
Community Support

Hi @mdbuzzer ,

1.Create three calculated columns.

``weeknum = WEEKNUM([Date],2)``
``Average = CALCULATE(AVERAGE('Table'[Value]),ALLEXCEPT('Table','Table'[weeknum]))``
``week = WEEKDAY([Date],2)``

2.Create a new table and create a relationship with main table.

``Table 2 = FILTER('Table',[week]=3)``

3.Create a calculated column in the new table.

``Rolling average = CALCULATE(SUM('Table 2'[Average]),FILTER(ALL('Table 2'),[Date]<=EARLIER('Table 2'[Date])))``

4.The result is as follows.

You can check more details from here.

Best Regards,

Stephen Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 REPLIES 4
Community Support

Hi @mdbuzzer ,

1.Create three calculated columns.

``weeknum = WEEKNUM([Date],2)``
``Average = CALCULATE(AVERAGE('Table'[Value]),ALLEXCEPT('Table','Table'[weeknum]))``
``week = WEEKDAY([Date],2)``

2.Create a new table and create a relationship with main table.

``Table 2 = FILTER('Table',[week]=3)``

3.Create a calculated column in the new table.

``Rolling average = CALCULATE(SUM('Table 2'[Average]),FILTER(ALL('Table 2'),[Date]<=EARLIER('Table 2'[Date])))``

4.The result is as follows.

You can check more details from here.

Best Regards,

Stephen Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helper I

Perfect! Thank you, that's exactly what I was looking for

Super User

a measure like

AverageX(filter(Table, Table[Col]>0),Table[Col])

For week wise data you can have columns like

Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1
Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)
Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense)

Measures
This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Last year Week= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))
Last 8 weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-8 && 'Date'[Week Rank]<=max('Date'[Week Rank])))

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...

last two weeks = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]<=max('Date'[Week Rank])-1

Helper I

not sure i'm getting the right result.

Below are the figures for Week 14 so the average of these values should equal 25.2

But it's returning an average of 3 for Week 14

Announcements

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Monthly Update - June 2024

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

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors