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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
dkernen
Resolver II
Resolver II

Date Comparison between two Related Tables

I have searched this forum, but I believe I have a very basic request. 

 

I have shimmied down my data model.  I have a fact table (factCase) with a date (TIncision_DT) and a dimension table (dimQuality) with a date (QTProcessorReview_DT) and I want to compare the time between TIncision_DT and QTProcessorReview_DT.  The tables are related by a common key Referral_ID.  The data flows from the dimension to the fact in a single direction as one-to-many, even though it really is a one-to-one relationship.  I would prefer to use a measure, but I could use a column if necessary.

 

Here is the reduced file.  https://mwtn-my.sharepoint.com/:u:/g/personal/dkernen_mwtn_org/EW3rlh1NB1hLlvHnQDwIoWQBWcuRa_SEjBsJS...

 

Any help on a formula/measure would be so helpful.  Thank you!

 

@dax, @DateComparisons

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @dkernen ,

 

You could use DATEDIFF() function.

https://docs.microsoft.com/en-us/dax/datediff-function-dax 

Example:

Measure = DATEDIFF(SELECTEDVALUE(factCase[TIncision_DT]),SELECTEDVALUE(dimQuality[QTProcessorReview_DT]),DAY)

3.PNG 

 

Best Regards,

Jay

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

View solution in original post

4 REPLIES 4
v-jayw-msft
Community Support
Community Support

Hi @dkernen ,

 

You could use DATEDIFF() function.

https://docs.microsoft.com/en-us/dax/datediff-function-dax 

Example:

Measure = DATEDIFF(SELECTEDVALUE(factCase[TIncision_DT]),SELECTEDVALUE(dimQuality[QTProcessorReview_DT]),DAY)

3.PNG 

 

Best Regards,

Jay

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

Thank you!  The was the only solution that worked - and worked without creating a new column.  You're incredible!  Thank you!

vanessafvg
Super User
Super User

the one has datetime values the other only had the date no time in it is that correct?

 

vanessafvg_0-1611776392059.png

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




That is correct.  But I do have another date/time field in the Quality dim table.  The QTQualityReview_DT is a true Date time.  I would like to compare the fact table's TIncision to both the ProcessorReview_DT (which is, as you stated, just a date) and also to the QualityReview_DT (which is a true datetime).  Thanks for eagle eyes!

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.