Forum Discussion
DATESBETWEEN Date and Time Field
Hi
I created the below new measure
PreviousYearAmount = CALCULATE(SUM[TaxAmt], DATEADD([Invoice Date],-1,YEAR))
And I get the below error
Calculation error in measure: A Date column with duplicate dates specified in the call function 'DATEADD'. This is not supported.
How do I resolve this?
Many invoices can be generated on a single date.
So in the filters provided, if year=2015 and month= Dec , my visual should comparison of Dec-15 amount with Dec-14.
if year=2014 and month= Dec then visual should comparison of Dec-13 and Dec-14.
The first parameter of DATEADD should be the column in your Calendar table. It looks like you are using a measure or a column in your fact table
- aksh10 years ago
Microsoft Employee
Hi
Sorry, I didn't get your message.
I want to know if I am creating a new measure (not a new column) can't I use a date column that has multiple duplicate values?
What is the resolution to this problem?
- Sean10 years ago
Community Champion
Time Intelligence Functions which DATEDD is one of - require a Date/Calendar table in your Data Model.
Go to Matt's link here and create one
http://www.powerpivotpro.com/2015/02/create-a-custom-calendar-in-power-query/
Then change your formula
PY Amount = CALCULATE(SUM([TaxAmt]), DATEADD(CalendarTableName[DateColumn], -1, YEAR) )