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! It's time to submit your entry. Live now!
Hello!
I'm looking to create a table that shows each of our stores sales by week and year. I am having issues when using the summarize function, however. I'm sure I'm doing something obviosly wrong but I haven't been able to determine a solution. We use a retail calendar so my calculate functions must use leverage the week and year fields.
The real end goal is to be able to pull current year sales if they had sales in sales 1PY or 2PY so we can analyze Same Store Sales with a CY sales that is on an apples to apples basis.
Here is my code
Sales PY =
var Sales_2PY = CALCULATE(
SUM('Daily Reporting'[Total Dine In Sales])
,DATEADD('Date'[Date],-364*2,DAY))
var Sales_1PY = CALCULATE(
SUM('Daily Reporting'[Total Dine In Sales])
,DATEADD('Date'[Date],-364,DAY))
Return
SUMMARIZE(
'Daily Reporting'
,'Daily Reporting'[UnitName]
,'Daily Reporting'[State]
,'Daily Reporting'[Week Number]
,'Daily Reporting'[Year]
,"DineIn_Sales_CY"
,SUM('Daily Reporting'[Total Dine In Sales])
,"DineIn_Sales_1PY"
,CALCULATE(
SUM('Daily Reporting'[Total Dine In Sales])
,FILTER('Daily Reporting'
,'Daily Reporting'[Weekday Nmbr]='Daily Reporting'[Weekday Nmbr]
&&'Daily Reporting'[Year]='Daily Reporting'[Year]-1))
,"DineIn_Sales_2PY"
,CALCULATE(
SUM('Daily Reporting'[Total Dine In Sales])
,ALL('Daily Reporting')
,FILTER('Daily Reporting'
,'Daily Reporting'[Week Number]='Daily Reporting'[Week Number]
&&('Daily Reporting'[Year])='Daily Reporting'[Year]-1))
)
Here is the result in the table I'm seeing:
You will want to check out the "Year Over Year To Date" pattern for that. If you have a proper calendar table then you can use time intelligence functions like SAMEPERIODLASTYEAR combined with the appropriate "to date" filters.
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 60 | |
| 49 | |
| 30 | |
| 25 | |
| 23 |
| User | Count |
|---|---|
| 128 | |
| 102 | |
| 57 | |
| 39 | |
| 31 |