Forum Discussion
Previous Year not working
Hi,
I am running a previous year measure with
Calculation error in measure 'Chalgrove FactSalesOrder'[Sales Prev Year]: A column specified in the call to function 'PREVIOUSYEAR' is not of type DATE. This is not supported.
The fulldate column is a date type..
Can anyone help?
Thanks
Chris
Sales Prev Year = CALCULATE( SUM( 'Chalgrove FactSalesOrderLine'[SaleValueBase] ), PREVIOUSYEAR( DimDate[FullDate] ) )
7 Replies
- ERD
Community Champion
Hi Anonymous ,
Check that DimDate[FullDate] is of Date type and try
Sales Prev Year = CALCULATE(SUM('Chalgrove FactSalesOrderLine'[SaleValueBase]),PREVIOUSYEAR(DimDate[FullDate]))
See https://dax.guide/previousyear/
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
- amitchandak
Super User
Anonymous ,Please mark this table as date tbale DimDate, also check data type of join column in FactSalesOrder, that should also be date column
if not
Can you share a sample pbix after removing sensitive data.
- AnonymousNot applicable
Hi amitchandak
I am unable to make it a dat table as there is missing dates. our system puts defasult dates starting at 1900 so we need to have that in there along with the other info.
Thanks
- CNENFRNL
Community Champion
Sales Prev Year = CALCULATE( SUM( 'Chalgrove FactSalesOrderLine'[SaleValueBase] ), PREVIOUSYEAR( DimDate[FullDate] ) )- AnonymousNot applicable
It is not failing now.. however it is not returning any values.
- CNENFRNL
Community Champion
No surprise; any measure evalutes in a comprehensive evaluation context. I helped correct syntactic error of DAX; analyse and author measures for desired results by yourself.