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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
RichOB
Post Partisan
Post Partisan

End date day count

Hi, I am looking for two things with the end dates:

 

1 - A day count between the End Date of one dog leaving a kennel, and the Start Date of the next dog entering that same kennel.

2 - If no dog has re-entered, I need the day count from the End Date to Today.

 

LocationDogKennelStart DateEnd Date Day Count
ManchesterMax124/02/202404/03/20240
ManchesterMilo104/03/202425/07/2024233
NewcastleBob212/07/202422/08/20244
NewcastleLola225/08/202410/09/2024186

 

What measure would get the Day Count column like the one, please?
Thanks!

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

You could create a calculated column like

Day count =
VAR EndDate = 'Table'[End Date]
VAR NextStartDate =
    CALCULATE (
        MIN ( 'Table'[Start Date] ),
        ALLEXCEPT ( 'Table', 'Table'[Location], 'Table'[Kennel] ),
        'Table'[Start Date] >= EndDate
    )
VAR Result =
    DATEDIFF ( EndDate, COALESCE ( NextStartDate, TODAY () ), DAY )
RETURN
    Result

View solution in original post

bhanu_gautam
Super User
Super User

@RichOB Create a calculated column to find the next start date for each kennel:

Next Start Date =
VAR CurrentKennel = 'Table'[Kennel]
VAR CurrentEndDate = 'Table'[End Date]
RETURN
CALCULATE(
MIN('Table'[Start Date]),
FILTER(
'Table',
'Table'[Kennel] = CurrentKennel &&
'Table'[Start Date] > CurrentEndDate
)
)

 

Create a calculated column to calculate the day count:

DAX
Day Count =
VAR NextStart = 'Table'[Next Start Date]
VAR CurrentEnd = 'Table'[End Date]
RETURN
IF(
ISBLANK(NextStart),
DATEDIFF(CurrentEnd, TODAY(), DAY),
DATEDIFF(CurrentEnd, NextStart, DAY)
)




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

Proud to be a Super User!




LinkedIn






View solution in original post

5 REPLIES 5
v-echaithra
Community Support
Community Support

Hi @RichOB ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,

Chaithra.

v-echaithra
Community Support
Community Support

Hi @RichOB ,

As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

 

Regards,

Chaithra.

v-echaithra
Community Support
Community Support

Thanks @bhanu_gautam , @johnt75  for Addressing the issue.

 

We would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Regards,
Chaithra E

bhanu_gautam
Super User
Super User

@RichOB Create a calculated column to find the next start date for each kennel:

Next Start Date =
VAR CurrentKennel = 'Table'[Kennel]
VAR CurrentEndDate = 'Table'[End Date]
RETURN
CALCULATE(
MIN('Table'[Start Date]),
FILTER(
'Table',
'Table'[Kennel] = CurrentKennel &&
'Table'[Start Date] > CurrentEndDate
)
)

 

Create a calculated column to calculate the day count:

DAX
Day Count =
VAR NextStart = 'Table'[Next Start Date]
VAR CurrentEnd = 'Table'[End Date]
RETURN
IF(
ISBLANK(NextStart),
DATEDIFF(CurrentEnd, TODAY(), DAY),
DATEDIFF(CurrentEnd, NextStart, DAY)
)




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

Proud to be a Super User!




LinkedIn






johnt75
Super User
Super User

You could create a calculated column like

Day count =
VAR EndDate = 'Table'[End Date]
VAR NextStartDate =
    CALCULATE (
        MIN ( 'Table'[Start Date] ),
        ALLEXCEPT ( 'Table', 'Table'[Location], 'Table'[Kennel] ),
        'Table'[Start Date] >= EndDate
    )
VAR Result =
    DATEDIFF ( EndDate, COALESCE ( NextStartDate, TODAY () ), DAY )
RETURN
    Result

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.