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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
andrea_chiappo
Helper III
Helper III

add one year to date column

This should be very easy, yet it doens't work

 

I tried both creating a new column and a new measure to get dates one year 

ahead with respect to the date column you see in the attachment.  

As you can see, the createdDate is in Date format.  

 

I tried the first logical thing:  

LastDate = DATEADD('TableName'[createdDate], 1, YEAR)
 
But I get the error (that's starting to become very annoying) that  
a table of multiple values was supplied where a single value was expected
 
I tried using DISTINCT() and even the function which usually prevents DAX from complainig, 
FIRSTNONBLANK, even if I'm absolutely unsure why, but time time neither of them works.
 

Capture_LI (2).jpg

 

Why doesn't it work?

Why can't it be easy to evaluate things with DAX?

Why most functions do not operate as the refernce says?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@andrea_chiappo 

As a new column is should have worked. Check are you creating a measure or column

You can also try a new measure like

New column = Date(year('TableName'[createdDate])+1,month('TableName'[createdDate]),day('TableName'[createdDate]))

View solution in original post

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Hi @andrea_chiappo ,

 

If the dates in the current context do not form a contiguous interval, the function returns an error. See this thread for a more comprehensive explanation.

You can try the formula mentioned in @amitchandak .

You can also try this:

LastDate = DATEADD('TableName'[createdDate].[DATE], 1, YEAR)

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Nope, it doesn't allow this operation, saying that:  

Column reference to 'createdDate' in table 'DimCustomers'cannot be used with a variation 'Date' because it does not have any  

 

 'createdDate' looks like this

Capture.PNG

amitchandak
Super User
Super User

@andrea_chiappo 

As a new column is should have worked. Check are you creating a measure or column

You can also try a new measure like

New column = Date(year('TableName'[createdDate])+1,month('TableName'[createdDate]),day('TableName'[createdDate]))

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors