Forum Discussion

KyleTheGirl's avatar
KyleTheGirl
Frequent Visitor
2 years ago
Solved

Need help with date range filters

I work in healthcare revenue cycle and in the past several years we have experienced multiple "events".  Is there a way to create a timeline as a filter with options to select different pre-set dates.

 

For example:

 

Covid Event: admit dates after 1/1/2020 to discharge dates before 11/30/2020

 

Change Healthcare Outage Event: admit dates after 2/21/2024 to discharge dates before 4/1/24.

 

I already have tables created for admit and discharge. 

 

I would like to be able to include and exclude those dates as a filter to the account data.

 

Any help would be greatly appreciated. 

 

*note: I thought about bookmarks but struggling with being able to keep other filters. (I'm fairly new to BI so if there is a workaround here too I love to know it)

  • lbendlin's avatar
    lbendlin
    2 years ago

    Then add an "Event" column to your calendar table.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi KyleTheGirl ,
    Thanks to lbe

    ndlin.
    Here is my another idea about this:
    Sample data

    Create a table

    Event = {"Covid","Change Healthcare Outage"}

    Create two measures

    Event = 
    SWITCH(
        TRUE(),
        SELECTEDVALUE('Table'[Admit Date]) > DATE(2020,1,1) && SELECTEDVALUE('Table'[Discharge Dates]) < DATE(2020,11,30),
        "Covid",
        SELECTEDVALUE('Table'[Admit Date]) > DATE(2024,2,21) && SELECTEDVALUE('Table'[Discharge Dates]) < DATE(2024,4,1),
        "Change Healthcare Outage"
        )
    IsFiltered = 
    IF(
        [Event] IN VALUES(Event[Value]),
        1,
        0
    )

    Apply the IsFiltered measure to the filter on this visual

    Final output

     

    Best regards,
    Albert He


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

     

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi KyleTheGirl ,
    Thanks to lbe

    ndlin.
    Here is my another idea about this:
    Sample data

    Create a table

    Event = {"Covid","Change Healthcare Outage"}

    Create two measures

    Event = 
    SWITCH(
        TRUE(),
        SELECTEDVALUE('Table'[Admit Date]) > DATE(2020,1,1) && SELECTEDVALUE('Table'[Discharge Dates]) < DATE(2020,11,30),
        "Covid",
        SELECTEDVALUE('Table'[Admit Date]) > DATE(2024,2,21) && SELECTEDVALUE('Table'[Discharge Dates]) < DATE(2024,4,1),
        "Change Healthcare Outage"
        )
    IsFiltered = 
    IF(
        [Event] IN VALUES(Event[Value]),
        1,
        0
    )

    Apply the IsFiltered measure to the filter on this visual

    Final output

     

    Best regards,
    Albert He


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

     

    • lbendlin's avatar
      lbendlin
      Super User

      Then add an "Event" column to your calendar table.

  • KyleTheGirl's avatar
    KyleTheGirl
    Frequent Visitor

    Thank you for the help!

    I ended up with a hybrid of both of these suggestions; I created an event column for the actual dates of the events but then used the formula in the second suggestion.

    The event column allowed me to create a more visual slicer with the event description.

    Thanks again for your help!