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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
osinquinvdm
Advocate II
Advocate II

How come the value is sometimes not calculated

I have a creation date and a delay.

I'm calculating the due date by adding the delay to the creation date

 

Date due = DATEADD([Date created];[Delay];DAY)

in 80% of the cases it works fine but for the remaining 20% nothing get returned.

Why could that be - especially when the date and the delay looks fine.

So fine that they are actually used in power query to sucessfully calculate the duration since the creation and the lateness (in red below).

2017-03-02 10_32_57-311-test - Power BI Desktop.png

Sure I can (and will) add the due date into the query but I'd like to understand the possible cause for that behaviour

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @osinquinvdm,

 

Please modify your formula as below, this will give all the due date as expected:

Date due = DATEADD(TableName[Date created].[Date],[Delay],DAY)

 

Best regards,
Yuliana Gu

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

View solution in original post

5 REPLIES 5
v-yulgu-msft
Employee
Employee

Hi @osinquinvdm,

 

Please modify your formula as below, this will give all the due date as expected:

Date due = DATEADD(TableName[Date created].[Date],[Delay],DAY)

 

Best regards,
Yuliana Gu

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

Nice Trick!

It does indeed work.

I wish DATEADD() was smart enough to force it like this on its own

Assuming the unit for [Delay] is a number of days, you could also write:

[Date created]+[Delay]
eyeball
Frequent Visitor

Hi osinquinvdm,

 

I believe the reason is that the date that you're trying to calculate doesn't exist in the column Date of Creation.  If you look at all the dates that have been created, they all seem to fall into November but the ones that haven't are all falling beyond Novemeber and I'd be fairly willing to bet that the rest of the data in your column doesn't go past November.

 

Here's the link the the DAX function definition:

https://msdn.microsoft.com/en-us/library/ee634905.aspx

 

There's a line in there that states:

The result table includes only dates that exist in the dates column

 

I'm hoping that someone better than I will be able to provide you with a solution on how to get round it!

Good luck!

Good catch @eyeball on the function disclaimer in the DAX documentation.

 

I'm not a big fan of * and small fonts, I'm more the type of guy who does not go though contract details and jump directly to the signature page 🙂

 

You are right, that test dataset is full of holes in terms of dates - so yes those dates where not part of the original date lists.

 

Anyway if that is the way dateadd() works I have no choice but do the work in the query. Which works fine (see below DAX calculation has been renamed date cible/target and M calculation is called date due).

 

Thanks so much for the quick follow-up (and attention to details)

 

2017-03-02 13_09_46-311-test - Power BI Desktop.png

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.