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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi Experts,
I need to calculate the average 4 weeks and 8 weeks from a table that contains an aggregate weekly values.
This table connects to calendar table using column that contains daily dates.
The NumOrders is what I wants to calculate - however PeriodDate is containing dates for WE 8th Nov.
Below is the snapshot:
Below is the total of weekly results:
I am using this DAX :
I think the issue is because the source table contains weekly dates vs daily dates and causing the calculation become wrong.
Is there a way to calculate this in DAX?
Solved! Go to Solution.
Hi,
PBI file attached.
Hope this helps.
Hi,
Share some data to work with and show the expected result. Share data in a format that can be pasted in an MS Excel file.
Hi Ashish - hope below is helping:
| WE_Friday | Subs_This_Week | Subs_Average_4_Weeks_Run_Rate | Desired Results |
| WE 2024-09-20 | 1455 | 1378 | 1519.75 |
| WE 2024-09-27 | 1446 | 1420 | 1554.5 |
| WE 2024-10-04 | 1715 | 1471 | 1587.75 |
| WE 2024-10-11 | 1463 | 1552 | 1507.75 |
| WE 2024-10-18 | 1594 | 1520 | |
| WE 2024-10-25 | 1579 | 1555 | |
| WE 2024-11-01 | 1395 | 1588 | |
| WE 2024-11-08 | 1493 | 1508 | |
| WE 2024-11-15 | 165 |
As I have mentioned the table orders have an aggregate weekly values and that connects to the calendar table that have daily dates.
I managed to create another calendar table that contains only week ending date only however the results does not seem to work as desired above.
Here's the DAX :
Hi @jhauw74 - Create a updated DAX measure as below:
Subs_Average_4_Weeks_Run_Rate =
AVERAGEX(
DATESINPERIOD(
'BOM_DIM_Date'[PeriodDate], -- Use the weekly period end date
MAX('BOM_DIM_Date'[PeriodDate]),
-4,
WEEK
),
[Submission_Order_Fixed_5G_Starlink]
)
Using DATESINPERIOD instead of manually filtering by week count is generally more reliable for time-based calculations in Power BI and should give you the correct 4-week average even with weekly aggregated data.
Proud to be a Super User! | |
Hi Raj - thank you for helping - I copied the DAX :
But it error out for the WEEK part - the Week ending date is just a normal date but only contains the Friday's date for the week.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 30 | |
| 28 |
| User | Count |
|---|---|
| 128 | |
| 88 | |
| 79 | |
| 67 | |
| 62 |