Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
I have a table as follows:
Year Week Sector Person Score
| 2020 | W1 | S1 | P1 | 28 |
| 2020 | W1 | S1 | P2 | 6 |
| 2020 | W1 | S1 | P3 | 8 |
| 2020 | W1 | S1 | P4 | 13 |
| 2020 | W1 | S2 | P1 | 28 |
| 2020 | W1 | S2 | P2 | 4 |
| 2020 | W1 | S2 | P3 | 7 |
| 2020 | W1 | S2 | P4 | 6 |
| 2020 | W1 | S3 | P1 | 4 |
| 2020 | W1 | S3 | P2 | 2 |
Full data here: Data Source
These are my requirements:
1. sector wise average score for the particular week - done as a column as follows
Weekly score Average - sector wise =
CALCULATE( AVERAGE( Table1[score]),
ALLEXCEPT(Table1, Table1[Week], Table1[Sector])
)
2. % total of sector wise score to weekly totals ( sum of score of sector for that week / sum of score of all sectors for that week) - done as a column as follows
% of sector score to weekly score =
var a = CALCULATE( SUM( Table1[score] ), ALLEXCEPT( Table1, Table1[Week] ,Table1[Sector] ))
var b = CALCULATE( SUM( Table1[score]), ALLEXCEPT(Table1, Table1[Week]))
return a/b
3. Ideal Score = Multiply 1 * 2
Now I want to calculate the 4 week moving average of Ideal Score (which is a sum product), and this is what I am not able to figure out how to do!
I added a calendar table with date, week and year columns, and then link that with week column of my table with many-many relation. Not sure if this is correct way.
Then, I have used the general DatesInPeriod with date column of calender table, with Ideal Score
4w rolling average =
VAR NoWeeks = 4
VAR _LastDate = MAX ( 'Calendar'[Date] )
VAR period = DATESINPERIOD ( 'Calendar'[Date], _LastDate, - NoWeeks * 7, DAY )
VAR a = CALCULATE (
AVERAGE ( 'Table1'[Ideal Score] ),
ALLEXCEPT ( 'Table1', '1Table'[Week] )
)
VAR result = CALCULATE ( a, period )
RETURN a
But I am not getting the required results. Please help me with this. Thank you.
Power Bi file: here
@v-ljerr-msft I have seen your solution, but did not work for me. Please guide with this -:)
@ar-data , Create a week rank in the date table
OR
Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format
measures
example measures
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Last 4 weeks = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]>=max('Date'[Week Rank])-4 && 'Date'[Week Rank]<=max('Date'[Week Rank])))
Hi @amitchandak, what I need is 4 week rolling average of sum product of 2 measures. Can you please help me with the formula for this using week rank. Thank you.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!