Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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

  • 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.

     

1 Reply

  • v-eachen-msft's avatar
    v-eachen-msft
    Icon for Community Support rankCommunity 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.