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
julsr
Resolver III
Resolver III

DatesMTD error when using all the data in my database

Hello everyone! I'm using the datesMTD calculation to get Month To Date values. First, I used it with one year of data, and it worked. Now, I've tried using it for 13 years of information, and I'm getting the following error:

julsr_1-1726208824404.png

 

What could be wrong with it? What should I fix on my code (find it below) or in my database to fix this error? (both tables are joined by a Key that generates a many-to-many relationship)

 

TotalMTDValue =
CALCULATE(
    SUM(database[amount]),
    REMOVEFILTERS(DatesTable[Date],DatesTable[month],DatesTable[year],DatesTable[month_name]),
    DATESMTD(DatesTable[Date]),
    TREATAS(
        VALUES(DatesTable[account_t]),
        database[type_account]
    )
)
1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@julsr  Try using below DAX

 

DAX
TotalMTDValue =
CALCULATE(
SUM(database[amount]),
DATESMTD(DatesTable[Date])
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @julsr ,

 

At my knowledge, using time intelligence functions requires the date table to be continuous and non-repeating date range.

Does your date table contain duplicate dates? If so, please try using the calendar() function to create a date table.

 

Best Regards,

Wearsky

bhanu_gautam
Super User
Super User

@julsr  Try using below DAX

 

DAX
TotalMTDValue =
CALCULATE(
SUM(database[amount]),
DATESMTD(DatesTable[Date])
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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.