Forum Discussion

jamiefisher's avatar
jamiefisher
Helper I
2 years ago
Solved

Using a date parameter / filter in a visual

I have a table of absences e.g

 

NameStart DateEnd Date
John01/08/2330/08/23
John10/03/2311/03/23
Mark02/08/2304/08/23

 

I want users to be able to select a date e.g. 03/08/23 and to return John and Mark as being absent on this date

 

How best would I do this?

  • Hi,

     

    If you are going to use a single value for your date selection you could use something like this:

     

    Measure =
        IF (
            SELECTEDVALUE('date'[Date]) >= CALCULATE(MAX('Table'[Start Date]))&&
            SELECTEDVALUE('date'[Date]) <= CALCULATE(MAX('Table'[End Date])),
            "Yes",
            "No"
        )
     
    you'll need a separate date table, i've included a PBIX file to review
     
    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

7 Replies

  • DOLEARY85's avatar
    DOLEARY85
    Resident Rockstar

    Hi,

     

    If you are going to use a single value for your date selection you could use something like this:

     

    Measure =
        IF (
            SELECTEDVALUE('date'[Date]) >= CALCULATE(MAX('Table'[Start Date]))&&
            SELECTEDVALUE('date'[Date]) <= CALCULATE(MAX('Table'[End Date])),
            "Yes",
            "No"
        )
     
    you'll need a separate date table, i've included a PBIX file to review
     
    If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
  • Thank you for this - applied it easily to my visuals and works beautifully 👍

    • jamiefisher's avatar
      jamiefisher
      Helper I

      Hi I have hit another issue, the measure works fine and displays a "yes" where absences cover the selected dates. I now want to do some counts and calculations but cannot do these on a measure, how do i do this?

      • DOLEARY85's avatar
        DOLEARY85
        Resident Rockstar

        Hi,

         

        You should still be able to do calculations on a measure, do you have an example of a calculation you are working on with some sample data and i'll have a look at it

         

        If I answered your question, please mark my post as solution, Appreciate your Kudos 👍