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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
tgalla01
Frequent Visitor

DateDiff Incorrect output

The code (Top part of attached image) was created to calculate the difference of the First_Order_Date from the Second_Order_Date which if done correctly should give and output of the number of days from the first order to the second order, however the output (example shown by blue arrow) is giving a very incorrect number, giving a -295 output though the orders were put in on the same day, meaning the correct output should be 0. If anyone could give an input as to the issue and a way to resolve it that would be much appreciated. Thanks!unnamed.png

1 ACCEPTED SOLUTION

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @tgalla01,

Can you please share a pbix or some dummy data that keep raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

lbendlin
Super User
Super User

This looks like a calculated column.  You may need to expand the filter context beyond the current row.

Yes it is a calculated column. Here is more insight on that particular piece and obviously has been a struggle. Designating the second order using this logic has been the only real way that I've been somewhat able to pin down the second order a customer has placed. 

tgalla01_0-1658411582504.png

 

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

I appreciate and thank you for the review. I see my error and will make the modification. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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