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
I have a table that basically looks liks this:
| Date | Article | Consumption |
| 2022-06-01 | A | 5 |
| 2022-05-03 | A | 4 |
| 2022-06-03 | B | 2 |
| 2022-06-01 | B | 4 |
| 2022-05-15 | B | 5 |
| 2022-06-04 | A | 3 |
I would like to have a calculated column where I get the average consumption by week and only based on the previous six months data. It should be separated by article and article
Solved! Go to Solution.
HI @vipett,
Did you mean to get the weekly total and average of rolling six months? If that is the case, you can try to use the following formula:
Formula =
AVERAGEX (
SUMMARIZE (
ADDCOLUMNS (
FILTER (
Table,
[Date]
>= DATE ( YEAR ( EARLIER ( Table[Date] ) ), MONTH ( EARLIER ( Table[Date] ) ) - 6, DAY ( EARLIER ( Table[Date] ) ) )
&& [Date] <= EARLIER ( Table[Date] )
&& [Article] = EARLIER ( Table[Article] )
),
"WeekNumber", WEEKNUM ( [Date], 2 ),
"Year", YEAR ( [Date] )
),
[Year],
[WeekNumber],
"Total", SUM ( Table[Consumption] )
),
[Total]
)
Regards,
Xiaoxin Sheng
HI @vipett,
Did you mean to get the weekly total and average of rolling six months? If that is the case, you can try to use the following formula:
Formula =
AVERAGEX (
SUMMARIZE (
ADDCOLUMNS (
FILTER (
Table,
[Date]
>= DATE ( YEAR ( EARLIER ( Table[Date] ) ), MONTH ( EARLIER ( Table[Date] ) ) - 6, DAY ( EARLIER ( Table[Date] ) ) )
&& [Date] <= EARLIER ( Table[Date] )
&& [Article] = EARLIER ( Table[Article] )
),
"WeekNumber", WEEKNUM ( [Date], 2 ),
"Year", YEAR ( [Date] )
),
[Year],
[WeekNumber],
"Total", SUM ( Table[Consumption] )
),
[Total]
)
Regards,
Xiaoxin Sheng
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!
| User | Count |
|---|---|
| 20 | |
| 11 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 31 | |
| 29 | |
| 21 | |
| 12 | |
| 12 |