Forum Discussion

moizsherwani's avatar
moizsherwani
Icon for Continued Contributor rankContinued Contributor
9 years ago
Solved

Count Number Of Active Orders

Hello Community,   So my table is a list of orders with a start date and end date such as the one below (the dates are in MM/DD/YYYY format).    ORDER_ID   START_DATE    END_DATE 1              ...
  • Sean's avatar
    Sean
    9 years ago

    moizsherwani

     

    Active Count =
    CALCULATE (
        DISTINCTCOUNT ( Table[ORDER_ID] ),
        FILTER (
            Table,
            Table[START_DATE] <= LASTDATE ( CalendarTable[Date] )
                && Table[END_DATE] >= FIRSTDATE ( CalendarTable[Date] )
        )
    )

    Good Luck! :smileyhappy:

     

    EDIT: There should be no relationship between these 2 tables!