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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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])))

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])))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.