Reply
Frequent Visitor
Posts: 2
Registered: ‎02-11-2019

DateAdd Measure

Hi Guys,

 

Please I am trying to create new measure this the follwoing:

 

LY Sales = CALCULATE([TotalSales], DATEADD('Date'[Date],-1,Year))
 
PowerBI retrurns error on the 'Year'
  
Kindly help!
 
 
Super User
Posts: 866
Registered: ‎06-23-2016

Re: DateAdd Measure

what's the error exactly? What's the syntax for [Total Sales]?
is the Date table marked as Date table, with Date[Date] as key column? see here https://docs.microsoft.com/en-us/power-bi/desktop-date-tables

is the join set to 1:many with single direction?

Highlighted
Frequent Visitor
Posts: 2
Registered: ‎02-11-2019

Re: DateAdd Measure

Hi Stachu,

 

Please se the screen shoot above

Capture1.JPGThanks

Super User
Posts: 866
Registered: ‎06-23-2016

Re: DateAdd Measure

weird, syntax looks correct, but maybe you can try with this one:

LY Sales =
CALCULATE ( [TotalSales], DATEADD ( 'Date'[Date], -1, YEAR ) )

I usually use https://www.daxformatter.com/ to verify syntax, maybe the spaces+capital letters will help

Community Support Team
Posts: 1,997
Registered: ‎07-10-2018

Re: DateAdd Measure

Hi @habbey2080,

 

If the issue still occur, kindly share your pbix to me . Please upload your files to One Drive and share the link here.

 

Regards,

Frank

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