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
Anonymous
Not applicable

Select current Quarter and Year until today

Hi there,

 

I am trying to show the following graphs:

 

  • Cumulative year to date sales vs. Cumulative sales target
  • Cumulative quarter to date sales vs. Cumulative sales target
  • Cumulative month to date sales vs. Cumulative sales target

 

For the month to date I have created the following formula to only filter out the days of the current month including today:

 

Current Month Until Today = IF(YEAR(Dates[Date]) = YEAR(TODAY()) && MONTH(Dates[Date]) = MONTH(TODAY()) && DAY(Dates[Date]) <= DAY(TODAY()) ,1,0)
 
Reason why I did this is because I only want the graph to show data until today and not for the rest of the days of the month. For month to date this works perfectly. However, for year and quarter to date this does not work well. For quarter to date I have the following formula: 
 
Current Quarter Until Today = IF(YEAR(Dates[Date]) = YEAR(TODAY()) && QUARTER(Dates[Date]) = QUARTER(TODAY()) && DAY(Dates[Date]) <= DAY(TODAY()) ,1,0)
 
This formula looks like it would work but it selects the dates in the current month until today, then skips the rest of the current month and selects all days of the rest of the quarter. 
 
Can someone please help me fix the formula for Current Quarter Until Today and Current Year Until Today?
 
Thank you in advance!
 
Best,
 
David
1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , You can use time intelligence for this , create a date table and join date from both tables to that

 

example

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))
Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Power BI — Qtr on Qtr with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-qtd-questions-time-intelligence-2-5-d842063da839
https://www.youtube.com/watch?v=8-TlVx7P0A0
Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

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.

May 2025 Monthly Update

Fabric Community Update - May 2025

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