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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
matteocarnelos
Frequent Visitor

Add Date: column with start and column with days to add

Hi guys,

in my report I want to add, for each row, some days to "today".

 

The days to add and the date today are in two calculated column named, respectively, "Copertura Giorni" and "Oggi", and both are in the same table "Tabella".

  

1.JPG

 

I've used this formula

 

Data Stock Out = DATEADD(Tabella[Oggi].[Date];'Tabella'[Copertura Giorni];DAY)

 

to add the days in "Copertura Giorni" to today.

 

The problem is that the formula works only when the results is within the year.

 

problema.JPG

 

Do you know where is the error or a way to solve?

 

Thank you.

1 ACCEPTED SOLUTION

Column = [Oggi] + [Copertura Giorni] * 1.

Make sure Column is formatted as a Date or Date/Time.

 

Date columns are really just numbers. They are the number of days since December 30th, 1899. The whole number portion is the number of days and the decimal portion is the time component.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

8 REPLIES 8
Greg_Deckler
Super User
Super User

If you want the number of days from some date to another date you can just subtract the two and make sure that the column is formatted to whole number.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Hi Greg,

thank you for reply.

 

I want the "Data Stock Out "date, for example:

 

input:

"Oggi" = 06/08/2018

"Copertura Giorni" = 10

 

output (with the formula):

"Data Stock Out" = 16/08/2018

Have you tried DATEADD it seems ideal to the case you have described. If it is not working somehow please share the pbix file there might be other issues due to which it might not be functioning as intended

I did confirm that DATEADD when using DAYS and adding a number of days that goes past the end of the year that the function returns blank. Seems like a bug to me.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

I think it too.

Do you think that someone should report the bug?

You could check the Issues forum here:

https://community.powerbi.com/t5/Issues/idb-p/Issues

And if it is not there, then you could post it.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Following @Greg_Deckler advixe i have posted the issue. Please read the blog to get better undestanding of the actual problem here which is also highlighted in the question.

Column = [Oggi] + [Copertura Giorni] * 1.

Make sure Column is formatted as a Date or Date/Time.

 

Date columns are really just numbers. They are the number of days since December 30th, 1899. The whole number portion is the number of days and the decimal portion is the time component.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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