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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Hyperchef1969
Helper V
Helper V

Datediff between date and minimum date

Hi,

 

I have two tables. First table contains workorder information. Second table contains material transations information. Join is on workorder ID and operation sequence number. I try to compare the release date from the workorder table with the MINIMUM transaction date from the materials transactions table. Return should be the number of days difference. For some reason I cannot compare both dates in the different tables, Power BI does not find direct relationship. Can anyone help?

 

Thanks in advance.

 

Capture.JPG

 

 

9 REPLIES 9
Hyperchef1969
Helper V
Helper V

Can anyone help? Thank you

Uzi2019
Super User
Super User

Hi @Hyperchef1969 
can you provide the sample data for both the tables??
would be easier for us to give you proper answer.

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

No sorry, it is confidential information.

Hi @Hyperchef1969 
No problem.

Can you provide the just sample data take same no of columns and change the values of a columns. And share both the files just screen shot of 4 to 5 records.

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Uzi2019, can you please have a look? thanks in advance

See below dataset as an example

Hi, see both tables for an example. Join_ID 5465083-100 can be used as an example. Once listed in the first table, multiple times in the second (transaction table). Outcome should be days difference between the minimum transaction date of the second table and the release date of the first table, by Join ID. Thanks in advance

Job_release_example.PNGMat_transaction_example.PNG

Hi @Hyperchef1969 

Please create the following measure:
difference = Datediff( Min(Transcation date), Max(Release date),day)

 

Let me know whether you are getting desired result of not.

 


If my post helps please give kudos and accept it as a solution!
Thanks

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Hi Uzi2019,

 

Was able to get this working, but facing the problem that the days include non working days. Added new working calender table to datamodel, linked on transaction date and working calender date. Extending the formula to 'CALCULATE(MIN(TRANSACTION DATE), MAX(RELEASE DATE),DAY), working CALENDER DATE = "Y") does not exclude non working days. Formula not ok? Or what do you think is not ok.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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