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
Jul1An
Frequent Visitor

Calculate date difference between two columns

Hello I have a table in which several incoming documents (from the customer) and several outgoing latters (from the company) are included for customers. I would like to calculate the average time difference between the youngest date of receipt (document receipt) and the oldest date of issue (of the letters) for each customer. Can anyone help here?

Jul1An_0-1671197795502.png

 

5 REPLIES 5
Greg_Deckler
Super User
Super User

@Jul1An No sample data so hard to know exactly what the DAX would be but I answered a very similar question here: YTD Change - Microsoft Power BI Community


@ 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...

Hey @Greg_Deckler. Thanks for helping. I have added an example to my post

@Jul1An Try:

Measure = 
  VAR __ID = MAX('Table'[Customer-ID]
  VAR __MinDate = MINX(FILTER('Table', [Customer-ID] = __ID), [Date of receipt])
  VAR __MaxDate = MAXX(FILTER('Table', [Customer-ID] = __ID), [Outgoing Date])
  VAR __Result = ( __MaxDate - __MinDate ) * 1.
RETURN
  __Result

@ 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...

Thanks that helped a lot @Greg_Deckler. One last question on the topic... How must your __Result variable be changed if there is also the case that a letter was sent before an inbox and this constellation should be hidden/ ignored? Can you help here as well?

Jul1An
Frequent Visitor

Hello @Greg_Deckler you have any ideas?

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.