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
Nischal
Helper I
Helper I

DAX TOTALYTD() - Duplicate Date Error

not able to visualize the YTD sales ... so what is wrong in the dax

 

Total Sales YTD = TOTALYTD(sales_attributes1[Total Sales],sales_attributes1[DATECREATED] )

 

the calculation error in sales[total sales ytd]: a date column containing a duplicate date was specified in the call to function 'datesytd' this is not supported

4 REPLIES 4
JPT145
Microsoft Employee
Microsoft Employee

4 years late but ... So I have found out If you already have a Column that has the dates lets call it {Date item was sold} or in your case if it lists the dates in a format such as {Friday, January 28,2022} then it the [TotalYTD] funtion won't work as a approrate value for the <Date> portion of the measurment.....and gives you the error you have seen.

 

The Date format I have seen the [TotalYTD] measure function like is MM/DD/YYYY once I Transformed my data in the {Date item was sold} from the date format of {Friday, January 28,2022} to {1/28/2022} then it worked like a charm!

 

 

Floriankx
Solution Sage
Solution Sage

Hello you have to create a separate DateTable with contigous unique dates and relate the date columns.

There are dozens of posts how to do so. Here or here.

 

Total Sales YTD = TOTALYTD(sales_attributes1[Total Sales],DateTabel[Dates] )

hi, both i tried doing the same by using calendar function the issue is i am getting a blank totalytd

ElliotP
Post Prodigy
Post Prodigy

Evening,

 

In tabular data models (power bi, tables & relationships) it's best to create a related date table to your fact table.

 

Your fact table typically contains all of your data, for example transaction log.

 

Your Date table is a representation of dates and the associated valeus as so you can filter against and use the columns in place of dates values from your fact table.

 

Here is a great template of a date table (https://www.sqlbi.com/articles/reference-date-table-in-dax-and-power-bi/); you can also google about for some simple Power Query to build you a super basic date table. Once you've added that in, join your fact and new date table with a relationship by the Date column in your fact table and the DateKey in the date table.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.