Forum Discussion

REWINDER's avatar
REWINDER
Frequent Visitor
4 years ago
Solved

Measure to filter rows based on two dates (begin and end date)

Hi everyone, I have been working on this problem for a couple of hours now and hope someone is able to help me solve this: Looking to get a measure with Active verhicles (>=Purchase date , <=Repl...
  • Jihwan_Kim's avatar
    4 years ago

    Hi,

    I am not sure if I understood your data model correctly, but please try the below measure and put it together with Date[Year] column from Date Table.

     

    #Vehicles Active =
    CALCULATE (
        COUNTROWS ( FleetActivity ),
        FILTER (
            ALL ( FleetActivity ),
            FleetActivity[PurchaseDate] <= MAX ( 'Date'[Date] )
                && FleetActivity[ReplacementDate] >= MIN ( 'Date'[Date] )
        )
    )