Forum Discussion

jostnachs's avatar
jostnachs
Helper IV
1 year ago
Solved

Custom date filter

Hi All... I have a requirement . I have 2 tables. client table (client name) and fact table(effective date & Expiration date). I have to have a active today filter to find the active clients as of t...
  • danextian's avatar
    1 year ago

    Hi jostnachs 

    Use a disconnected dates table and create this measure:

     

    Client by Time Period = 
    VAR StartDate =
        MIN ( Dates[Date] )
    VAR EndDate =
        MAX ( Dates[Date] )
    RETURN
        COUNTROWS (
            FILTER (
                Client,
                Client[EffectiveDate] <= EndDate
                    && Client[ExpirationDate] >= StartDate
            )
        )
    

     

    This will return more than 1 only in the dates when the expiraiton and effective dates overlap

     

    Please see the attached pbix for details.

     

    Note: moving forward, please use a sample that we can easily copy paste as table to excel and not an image.