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
Fphizal
Regular Visitor

POWER BI

Fphizal_0-1723086367079.png

I want to calculate days between "DesignStartdate" and "datesentforreview"

I have created a relationship and still unable to derive the number of days required between dates.

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

Thanks for your insight, bhanu_gautam.

 

@Fphizal , if you want to calculate days between "DesignStartdate" and "datesentforreview", you need to make sure there's a valid relationship.

vstephenmsft_2-1723539217062.png

vstephenmsft_3-1723539223865.png

vstephenmsft_1-1723539158999.png

In this case, the relationship is one-to-one, and the number of days can be successfully calculated. Create a measure to return days.

Measure = DATEDIFF(MAX('Artwork Tracker'[DesignStartdate]),MAX('Review List'[datesentforreview]),DAY)

vstephenmsft_0-1723539138837.png

 

 If the relationship is a one-to-many pair, the number of days can also be successfully calculated.

vstephenmsft_2-1723539217062.png

vstephenmsft_4-1723539292438.png

vstephenmsft_6-1723539372454.png

vstephenmsft_7-1723539388430.png

 

If the above requirements do not meet you, please provide more details. It's a good idea to provide some simple sample data and the desired results, as I did.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Thanks for your insight, bhanu_gautam.

 

@Fphizal , if you want to calculate days between "DesignStartdate" and "datesentforreview", you need to make sure there's a valid relationship.

vstephenmsft_2-1723539217062.png

vstephenmsft_3-1723539223865.png

vstephenmsft_1-1723539158999.png

In this case, the relationship is one-to-one, and the number of days can be successfully calculated. Create a measure to return days.

Measure = DATEDIFF(MAX('Artwork Tracker'[DesignStartdate]),MAX('Review List'[datesentforreview]),DAY)

vstephenmsft_0-1723539138837.png

 

 If the relationship is a one-to-many pair, the number of days can also be successfully calculated.

vstephenmsft_2-1723539217062.png

vstephenmsft_4-1723539292438.png

vstephenmsft_6-1723539372454.png

vstephenmsft_7-1723539388430.png

 

If the above requirements do not meet you, please provide more details. It's a good idea to provide some simple sample data and the desired results, as I did.

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

bhanu_gautam
Super User
Super User

@Fphizal , 

Create a new calculated column by going to modelling tab and click on new column

 

DaysBetween =
DATEDIFF(
    'ArtworkTracker'[Designstartdate],
    RELATED('Review List'[datesentforreview]),
    DAY
)



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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.