Forum Discussion

ERing's avatar
ERing
Icon for Post Partisan rankPost Partisan
2 years ago
Solved

How to return only records for a date between two other dates?

I have data like below where each work order has an Start_Date, In_Progress_Date, and End_Date. My requirement is a report where there is a slicer for the Start_Date and  slicer for the End_Date and the table visual shows only records with an In_Progress_Date between the Start_Date and End_Date.

 

In the example where the user selects a Start_Date of 09/30/23 and an End_Date of 11/01/23, work orders 9 & 10 would be excluded because the In_Progress_Date falls on or before the Start_Date or on or after the End_Date.

 

Work_Order_IDStart_DateIn_Progress_DateEnd_Date
19/30/202310/1/202311/1/2023
29/30/202310/2/202311/1/2023
39/30/202310/3/202311/1/2023
49/30/202310/4/202311/1/2023
59/30/202310/5/202311/1/2023
69/30/202310/6/202311/1/2023
79/30/202310/7/202311/1/2023
89/30/202310/8/202311/1/2023
99/30/20239/30/202311/1/2023
109/30/202311/1/202311/1/2023
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi ERing

     

    I ran the following test.

     

    1. Create two slicer table

     

     

    2. Create a measure as follows

     

    Measure = 
    IF( 
        SELECTEDVALUE('Table'[In_Progress_Date]) > SELECTEDVALUE(startdate[Date]) 
        && SELECTEDVALUE( 'Table'[In_Progress_Date]) < SELECTEDVALUE(endstart[Date]),
        1,
        0
    )

     

     

    Put the measure into the filter so that the visual only shows data where the measure is equal to 1.

     

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Yuliax

     

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

4 Replies

  • Try the following : 

     

    Filtered Work Orders = 
    CALCULATE(
        COUNTROWS('YourTableName'),
        FILTER(
            'YourTableName',
            'YourTableName'[In_Progress_Date] > MAX('YourTableName'[Start_Date]) &&
            'YourTableName'[In_Progress_Date] < MIN('YourTableName'[End_Date])
        )
    )
    • ERing's avatar
      ERing
      Icon for Post Partisan rankPost Partisan

      Hi AmiraBedh I'm not looking to return a count. I need to be able to show a table visual with the results. In this case I want my table visual to exclude the last two rows. 

       

      • AmiraBedh's avatar
        AmiraBedh
        Icon for Super User rankSuper User

        A calculated column maybe ?

         

        Is Within Date Range = 
        IF(
            AND(
                'YourTableName'[In_Progress_Date] > SELECTEDVALUE('YourTableName'[Start_Date]),
                'YourTableName'[In_Progress_Date] < SELECTEDVALUE('YourTableName'[End_Date])
            ),
            1,
            0
        )
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ERing

     

    I ran the following test.

     

    1. Create two slicer table

     

     

    2. Create a measure as follows

     

    Measure = 
    IF( 
        SELECTEDVALUE('Table'[In_Progress_Date]) > SELECTEDVALUE(startdate[Date]) 
        && SELECTEDVALUE( 'Table'[In_Progress_Date]) < SELECTEDVALUE(endstart[Date]),
        1,
        0
    )

     

     

    Put the measure into the filter so that the visual only shows data where the measure is equal to 1.

     

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Yuliax

     

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