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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
DJOXXXA
Helper I
Helper I

Calculate YTD value with Week slicer

Hi all, 

 

I have a small question regarding YTD and MTD calculation with filters for weeks in Power BI:

I want to create a card which will show this years YTD vs last years YTD as a percentage, but for some reason, PBI only calculates YTD measure from the first date in the selected week. I have tried to bypass this problem with the following measures:

First Date in the Year = DATE(YEAR(MIN('Calendar'[Date]));1;1)
Latest Date = MAX('Calendar'[Date])
YTD Value = CALCULATE(SUM(Footfall[Total Entries]);FILTER('Calendar';'Calendar'[Date] >= [First Date in the Year] && 'Calendar'[Date] <= [Latest Date]))
For some reason, measure disregards the first part when calculating the YTD, so I am not sure how to fix this. Is there any way to bypass the filter, so my YTD measure would calculate measure from the first date in the year and up to the latest selected date in the filter?
Thank you all in advance!
1 ACCEPTED SOLUTION

Hi all,

 

Turns out, I was using the correct formulas, but my Date column in my Calendar was not Marked as Date Table, and that was causing this issue.

View solution in original post

5 REPLIES 5
Mariusz
Community Champion
Community Champion

Hi @DJOXXXA 

 

Try this.

Sales Year To Date = 
CALCULATE(
    [Sales],
    DATESYTD( 'Calendar'[Date] )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Dear Mariusz,

 

Thank you for your reply! I have this formula set up already, but it is not working properly. As you can see, first picture represents the table without any slicers:1.JPG

 

 

And this picture represents the same table with slicer for week: (as you can see, PBI recalculates YTD measure from the first date in the selected week, not from the January 1st)

 

2.JPG

Hi all,

 

Turns out, I was using the correct formulas, but my Date column in my Calendar was not Marked as Date Table, and that was causing this issue.

Mariusz
Community Champion
Community Champion

Hi @DJOXXXA 

 

Happy you have sort it out.

 

Best Regards,
Mariusz

Please feel free to connect with me.
Mariusz Repczynski

 

Thanks, sorry for wasting your time 😞

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.