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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

YTD/QTD/MTD table

Hi,

I have created a table that calculate dates for YTD, QTD and MTD, but there seems to be something wrong, because only the YTD gives me the dates for the current year, the QTD and MTD give me much more dates than it should.
Can someone tell me what is wrong?

YTD/QTD/MTD =
var today=TODAY()
var start_of_year=CALCULATE(STARTOFYEAR('Dim Date'[Date]),YEAR('Dim Date'[Date])=YEAR(today))
var start_of_quarter=CALCULATE(STARTOFQUARTER('Dim Date'[Date]),QUARTER('Dim Date'[Date])=QUARTER(today))
var start_of_month=CALCULATE(STARTOFMONTH('Dim Date'[Date]),MONTH('Dim Date'[Date])=MONTH(today))
var finalresult=
UNION(ADDCOLUMNS(
CALENDAR(start_of_year,today),
"selection","YTD"
),
ADDCOLUMNS(
CALENDAR(start_of_quarter,today),
"selection","QTD"
),
ADDCOLUMNS(
CALENDAR(start_of_month,today),
"selection","MTD"
)
)return finalresult
1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage
3 REPLIES 3
daxer-almighty
Solution Sage
Solution Sage

daxer-almighty
Solution Sage
Solution Sage

Yeah... You're doing this:

CALCULATE(STARTOFQUARTER('Dim Date'[Date]),QUARTER('Dim Date'[Date])=QUARTER(today))

without paying attention to the fact that quarters exist in different years and have the same numbers. You're missing a filter on the year column.

Anonymous
Not applicable

Thanks, but can you tell me how to include the filter? I am not sure how to do that.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Users online (1,423)