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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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]))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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]))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors