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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

A Date Column Containing duplicate Date was specified in the call to function

Hi All,

 

I created a slicer which will have Month-Year(eg., oct-2019,Nov-2019 etc) and Year values(2019,2020,etc). I got this by creating calculated table.

 

Then i created Percentage Difference by year and then by Month.

 

When i tried in my local with sample data(csv) set it worked fine but when i connected to my backend i.e., oracle percent difference calculation was throwing error.

 

Provided my Percent Differencee for Year Formula

Year Percent Difference monthend% =
var YTD_Sales = CALCULATE(SUM('Calculated Table'[C_Sales]),DATESYTD('Calculated Table'[C_Sales_Date]),ALLEXCEPT( 'Calculated Table','Calculated Table'[C_Source_System],'Calculated Table'[Time_Dimension]))
var last_YTD_Sales = CALCULATE(SUM('Calculated Table'[C_Sales]),DATESYTD(ENDOFYEAR(dateadd('Calculated Table'[C_Sales_Date],-1,YEAR))),ALLEXCEPT( 'Calculated Table','Calculated Table'[C_Source_System],'Calculated Table'[Time_Dimension]))

return (divide(YTD_Sales,last_YTD_Sales)-1) *100

 

It was working fine in sample dataset.

 

Provided the error when it was connected to backend

 

Couldn't load the data for Visual

MDX Scipt Model (20,75) calculation error in Measure 'Table'[Year percent Difference]: A Date Column Containing duplicate Date was specified in the call to function. 'DatesYTD'. This is not supported

 

Thanks in Advance

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Actually there are duplicate values in your table ( same date in multiple rows ).And you are using time intelligence functions DATESYTD which in DAX need a separate date table/dimension.

You could create a calendar table with unique and continuous dates that cover all periods of your fact table.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Actually there are duplicate values in your table ( same date in multiple rows ).And you are using time intelligence functions DATESYTD which in DAX need a separate date table/dimension.

You could create a calendar table with unique and continuous dates that cover all periods of your fact table.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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