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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
PBI_Student
New Member

How many days beetween 2 dates?

Hello everyone!

 

I'm working on a PBI dataset and I have 2 columns with date type rows. For each row, I need to calculate how many days are beetween those 2 dates.

Could anyone of you please tell me if there's any calculated measure I can use to do so?

Wish you all a very nice day!

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

Hi  @PBI_Student ,

There are the following ways to achieve this:

Create measure:

DATEDIFF = DATEDIFF(MAX('Table'[Date1]),MAX('Table'[Date2]),DAY)
INT = ABS( INT(MAX('Table'[Date1])-MAX('Table'[Date2])))
1ABS = ABS( 1 * (MAX('Table'[Date1]) - MAX('Table'[Date2])))

vyangliumsft_0-1646805898775.png

Best Regards,

Liu Yang

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

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @PBI_Student ,

There are the following ways to achieve this:

Create measure:

DATEDIFF = DATEDIFF(MAX('Table'[Date1]),MAX('Table'[Date2]),DAY)
INT = ABS( INT(MAX('Table'[Date1])-MAX('Table'[Date2])))
1ABS = ABS( 1 * (MAX('Table'[Date1]) - MAX('Table'[Date2])))

vyangliumsft_0-1646805898775.png

Best Regards,

Liu Yang

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

Tahreem24
Super User
Super User

 @PBI_Student ,You can sue DATEDIFF for calculting a no. of days between two dates range.https://docs.microsoft.com/en-us/dax/datediff-function-dax

No. of Days =DATEDIFF(MIN( Calendar[Date] ), MAX( Calendar[Date]), DAY )

 

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

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
amitchandak
Super User
Super User

@PBI_Student , what you mean by -2 columns with date type rows?

 

Usually Datediff can help

 

Measure

Sumx(Table, datediff([Date1], [Date2], day))

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors