Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Get a between date from two different filters

Hello all,

 

i need to make it that selecting one date from the slicer to the left and one date from the slicer to the right gives me a between range of data from both selected filters.

 

 

  • Anonymous ,

    Date Range Using 2 slicer =
    var _max = minx(allselected(Date1), Date1[Date])
    var _min = maxx(allselected(Date2), Date2[Date])
    return
    calculate(countrows(Table), Filter(Table,Table[Date] <=_max && Table[Date] >=_min) )

     

     

    Instead of month, you need two dates

     

    Select data between months - https://youtu.be/nEt7dT3Tfv4

3 Replies

  • Anonymous ,

    Date Range Using 2 slicer =
    var _max = minx(allselected(Date1), Date1[Date])
    var _min = maxx(allselected(Date2), Date2[Date])
    return
    calculate(countrows(Table), Filter(Table,Table[Date] <=_max && Table[Date] >=_min) )

     

     

    Instead of month, you need two dates

     

    Select data between months - https://youtu.be/nEt7dT3Tfv4

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    According to your statement, I think you want to show values in date range.

    1. If you only want one date table in your report, you can create a relationship between it and your data table. Then you can use between slicer directly.

    2. If you still want two slicers, one for range start and another one for range end, you need to create two unrelated date tables for these two slicers. Then create a measure to calculate the value in range.

    Value in Date Range = 
    VAR _SELECT1 =
        SELECTEDVALUE ( 'Range Start'[Date] )
    VAR _SELECT2 =
        SELECTEDVALUE ( 'Range End'[Date] )
    RETURN
        CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER (
                'Table',
                AND ( 'Table'[Date] >= _SELECT1, 'Table'[Date] <= _SELECT2 )
            )
        )

    Relationship:

    Result is as below.

     

    Best Regards,
    Rico Zhou

     

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Rico,

       

      thanks for the reply, another question. The thing is that in the 3rd table where the value is i do not have a Date column i have a Period_ID that has a relationship to the other 2 Date tables. So i would need to filter by that Period_ID column.