Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

DAX - Count Days Between two date fields on a Date Axis

Hello,   I'm trying to use DAX to count every day between two date fields for a large dataset and create a stacked column chart broken out by Program.  You can do this in excel by means of the COUN...
  • bolfri's avatar
    3 years ago

    Hi,

     

    hope this will help you. Dynamic measure based on your calendar.

    Count Correct Rows =
    var date_ref = SELECTEDVALUE(dim_calendar[Date])
    return
        COUNTX(
            FILTER('Sample';AND('Sample'[Status Start Date] <= date_ref;'Sample'[Status End Date]>=date_ref));
            COUNTROWS('Sample')
        )
     
    You can use Program column as you want. No relationship needed.