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
PatrickWork2021
Frequent Visitor

Show actual, month to date and year to date dynamically

Hi

I have a report that uses a fiscal calendar table in my model. On a Monday when I run my stats I want to show on a graph, the previous weeks value, the month to date value and the YTD value.

 

I have a slicer for fiscal week which will give me the previous weeks info but I then need to show the month to date based on that week and also the year to date. So if I am filtering on Week 2, I would see week 2, month to date would show sum of week 1 and 2, year to date in this instance would also show sum week 1 and 2.

 

As another example, lets fast forward to week 6 which would be the 2nd week of May, if I filter on week 6 I would see Week 6, I would see weeks 5 and 6 for month to date and then all 6 weeks for YTD.

 

How can I achieve this?

 

Thanks

2 REPLIES 2
amitchandak
Super User
Super User

@PatrickWork2021 , Make sure that week are part date table, based on week you have alose create fiscal year and fiscal month

 

then you can have measures like

 

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

 

 

and for month

 

MTD= CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[Month]=max('Date'[Month])  && 'Date'[Week] <= Max('Date'[Week]) ))
LMYTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Month]=max('Date'[Month]) && '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

Hi, thanks for this, with a slight amendment it looks to have worked. One challenge I have though with a couple of metrics I need to apply this to is that the calculating field is a measure which it doesnt seem to allow me to select. Is there anything I can do to amend for when the field being calculated is a measure?

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.