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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
PowerMarra
Regular Visitor

YTD with 53 weeks

Hi,

 

I want to calculate YTD and use this calculateion for different years. The YTD formula works fine for 2019 and 2021, but for 2020 it is a problem due to 53 weeks. It summuraize, but it will not show a subtotal thus it will not aggregate.

PowerMarra_0-1638455774176.png 

PowerMarra_1-1638455794818.png

 

I tried another formula in order to take into account 53 weeks: 

YTD Value TEST =
var currentyear = SELECTEDVALUE('Calendar'[Iso Year])
var currentweek = SELECTEDVALUE('Calendar'[Week])

return
CALCULATE(Hovedmeasures[Value Sales],
fILTER(ALL('Calendar'),
'Calendar'[Iso Year] = currentyear && 'Calendar'[Week] <= currentweek)
)
 
But this will not summaraize either.
 
Does anyone know how to calculate YTD so I also can use it for those years with 53 weeks?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @PowerMarra ,

I created some data:

Hovedmeasures:

vyangliumsft_0-1638862489214.png

Calendar:

vyangliumsft_1-1638862489217.png

The relationship between the two tables is one-to-one and Both.

Here are the steps you can follow:

1. Create measure.

YTD Value TEST =
CALCULATE(SUM('Hovedmeasures'[rand]),DATESYTD('Calendar'[Date]))

2. Result:

vyangliumsft_2-1638862489219.png

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @PowerMarra ,

I created some data:

Hovedmeasures:

vyangliumsft_0-1638862489214.png

Calendar:

vyangliumsft_1-1638862489217.png

The relationship between the two tables is one-to-one and Both.

Here are the steps you can follow:

1. Create measure.

YTD Value TEST =
CALCULATE(SUM('Hovedmeasures'[rand]),DATESYTD('Calendar'[Date]))

2. Result:

vyangliumsft_2-1638862489219.png

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

amitchandak
Super User
Super User

@PowerMarra , I think a measure like this should work , assuming [Value Sales] is a measure else use an aggregation like sum([Value Sales])

 

CALCULATE([Value Sales],
fILTER(ALL('Calendar'),
'Calendar'[Iso Year] = max('Calendar'[Iso Year]) && 'Calendar'[Week] <=  max('Calendar'[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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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