Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Basti76
Helper I
Helper I

Cumulative data per week of year and year

Hello,

 

I am a pretty new user to PowerBI. I would like to set up a comined graph. Sales per week comparing current with previous year by week. This is no problem. But I would like to add to lines with the cumulated sales per week for the current and the previous year. 

 

I have tried setting up a new measure using a DAX expression I found in another post:

Measure =
CALCULATE( SUM(Sales[SalesValue), FILTER(ALL(Calendar), Calendar[WeekNumber] <= SELECTEDVALUE(Calendar[WeekNumber]) ) )

 

I guess I have to set up one measure per year and add to the formula a filter for the year? Am I on the right track and how would I modify the formula to get the desired result?

Thanks,
Bastian

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Basti76 , Try like with date table or an independent Year/week table joined to your table


YTD= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[Week] <= Max('Date'[Week]) ))
LYTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Week] <= Max('Date'[Week])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Basti76
Helper I
Helper I

Brillant @amitchandak . That worked perfectly. Thank you!

amitchandak
Super User
Super User

@Basti76 , Try like with date table or an independent Year/week table joined to your table


YTD= CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[Week] <= Max('Date'[Week]) ))
LYTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Week] <= Max('Date'[Week])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.