Forum Discussion

DateSurfer's avatar
DateSurfer
New Member
2 years ago
Solved

Counting rows/incidences between date columns

I have a table of the form:    ID Status Start_Date End_Date 0001 Registered 01/01/2024 02/01/2024 0001 In-Progress 02/01/2024 05/01/2024 0002 Registered 02/01/2024 04/01...
  • speedramps's avatar
    2 years ago

    Click here to download solution

    Download PBIX from Onedrive 

     

    How it works  ...

     

    Create relationships

     

    Create dax measure ...

    ValidCount = 
    VAR mindate = MIN('Calendar'[Date])
    VAR maxdate = MAX('Calendar'[Date])
    VAR mysubset = FILTER(Facts,Facts[Start_Date] <= maxdate && Facts[End_Date] <= mindate)
    RETURN
    CALCULATE(
    DISTINCTCOUNT(Facts[ID]),
    mysubset
    )

     

    Create report ...

     

    Thanks for the clear description of the problem with example data. I wish everyone did that!

    Remember we are unpaid volunteers, and you have got free expert help which took a lot of effort,
    This solution works and does exactly what you asked.
    So please quickly click the [accept as solution] and the thumbs up button to leave kudos. 

    One question per ticket please. If you need to change or extend your request then please raise a new ticket.

    You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

    If you quote speedramps in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.

    Please now click the [accept as solution] and the thumbs up button.  Thank you.