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 all,
I want to create this visual in PBI for our [sales] measure (pretend that w.2 is last week and for 52 weeks.
So, one line to show the sales rolling 52 weeks and one to show the same period the year before.
Can you please advise? I have a week column in my date table which is a whole number and a YearWeek column which is stored as text. No changes can be made to the formats and I am not allowed to create any new columns.
Thanks!
Hi @mrclay823
To create this rolling 52-week comparison visual in Power BI with one line for the last 52 weeks and another for the same period the previous year, you can use DAX measures. Since you cannot modify column formats or create new columns, we will work with measures only.
This measure will sum the sales for the last 52 weeks dynamically:
Sales Rolling 52 Weeks =
VAR MaxWeek = MAX('Date'[Week]) -- Get the latest selected week
VAR MaxYearWeek = MAX('Date'[YearWeek]) -- Get the latest YearWeek in context
RETURN
CALCULATE(
SUM(Sales[SalesAmount]),
'Date'[YearWeek] <= MaxYearWeek &&
'Date'[YearWeek] > MaxYearWeek - 52 -- Include the last 52 weeks
)
To compare the same period from the previous year, shift the YearWeek by 52 weeks back:
Sales Rolling 52 Weeks LY =
VAR MaxWeek = MAX('Date'[Week])
VAR MaxYearWeek = MAX('Date'[YearWeek])
RETURN
CALCULATE(
SUM(Sales[SalesAmount]),
'Date'[YearWeek] <= MaxYearWeek - 52 &&
'Date'[YearWeek] > MaxYearWeek - 104 -- Shift 52 weeks back
)
@mrclay823 , Create Measures for Rolling 52 Weeks Sales:
Rolling52WeeksSales =
CALCULATE(
SUM(Sales[SalesAmount]),
DATESINPERIOD(
DateTable[Date],
MAX(DateTable[Date]),
-52,
WEEK
)
)
Create Measures for the Same Period Last Year:
Rolling52WeeksSalesLastYear =
CALCULATE(
[Rolling52WeeksSales],
SAMEPERIODLASTYEAR(DateTable[Date])
)
Add the DateTable[Date] to the axis.
Add the Rolling52WeeksSales measure to the values.
Add the Rolling52WeeksSalesLastYear measure to the values.
Proud to be a Super User! |
|
Hi,
Hi there @mrclay823
Have you tried this?
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 |
|---|---|
| 21 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 32 | |
| 31 | |
| 20 | |
| 12 | |
| 12 |