cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gauravnarchal
Post Prodigy
Post Prodigy

Number of Nights between two dates

Hello All

 

Is there a way to calculate the Number of Nights between two dates?

 

If so, please suggest a way to do it as a calculated column & through the measure.

 

Many thanks

Gaurav

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

Hi  @gauravnarchal ,

I create some data:

vyangliumsft_0-1624929691163.png

Here are the steps you can follow:

1. Create calculated column.

 

day_number = DATEDIFF('Table'[Start date],'Table'[End date],DAY)

 

2. Result:

vyangliumsft_1-1624929691187.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  @gauravnarchal ,

I create some data:

vyangliumsft_0-1624929691163.png

Here are the steps you can follow:

1. Create calculated column.

 

day_number = DATEDIFF('Table'[Start date],'Table'[End date],DAY)

 

2. Result:

vyangliumsft_1-1624929691187.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.

AnalystPower
Helper I
Helper I

"Days Between = DATESBETWEEN ( 'Table' [Dates], 'Table' [Start Date], 'Table [End Date] ) This will return a single number for the number of days between the two dates."

 

https://community.powerbi.com/t5/Desktop/calculate-number-of-days-between-2-dates/m-p/51213#:~:text=....

 

Fowmy
Super User
Super User

@gauravnarchal 

What is the night definition you would use? I mean the time frame

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show Episode 10 Recap

The Power BI Community Show

Watch the playback when Amit Chandak, a Power BI Super User, demos how to use Field Parameters to make reports more dynamic.

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Health and Life Sciences Power BI User Group

Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate.

Top Solution Authors