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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Ataboyata
Regular Visitor

Difference in Dates Measure with Info from Different Tables

Hi, 

I am trying to create a measure that shows the difference between two dates. Each date is stored in a different table and they are referenced to a single ID.

 

For example,

 

Table: Shipping Dates

POid         ShippingDate

A1            12/dec/2016

A2            13/dec/2016

A3            14/dec/2016

 

Table: Payment Dates

POid         PaymentDate

A1            17/dec/2016

A2            18/dec/2016

A3            19/dec/2016

 

What I am looking for is a Measure that shows: Days Payment after Shipment = Payment Date - Shipping Date. 

 

I have done this through a calculated column (Within a third table called 'POHeader') but I would like to take advantage of the capabilities that measures have. 

Days Payment After Shipment =
IF(RELATED('Shipping Dates'[ShippingDate])=BLANK(),BLANK(),
IF(RELATED('Payment Dates'[PaymentDate]=BLANK(),BLANK(),
IF(RELATED('Payment Dates'[PaymentDate]-RELATED('Shipping Dates'[ShippingDate])))

Result:

Table: POHeader

POid        Days Payment after Shipment

A1            5

A2            5

A3            5

 

If anyone knows how to do this within a Measure, please let me know!

 

Thanks!

1 ACCEPTED SOLUTION
Baskar
Resident Rockstar
Resident Rockstar

1.JPG

 

 

2.JPG

 

 

PLs find the image it will solve your prob 

View solution in original post

3 REPLIES 3
Baskar
Resident Rockstar
Resident Rockstar

1.JPG

 

 

2.JPG

 

 

PLs find the image it will solve your prob 

I use this formula but I keep getting a result of 365 days for all columns. the difference doesn't show up.

 

Time_diff_RAtoSub = DATEDIFF(MAX('AEF_RESOURCE_ASSIGNMENT_FORM'[Resources Completed].[Date]),MAX('PRIMARY_AEF_REQUEST'[IRM_START_DATE].[Date]),DAY)

 

Result i get is 365 for each row.

 

I dont understand where i'm going wrong? Anyone, please help.

Thank you

Vvelarde
Community Champion
Community Champion

@Ataboyata

 

Dif-Days =
IF (
    HASONEVALUE ( ShippingDates[POid] ),
    DATEDIFF (
        VALUES ( ShippingDates[Shipping Date] ),
        VALUES ( PaymentDates[PaymentDate] ),
        DAY
    )
)



Lima - Peru

Helpful resources

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