Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Timerange filter from selected row

Hi everyone, I have ran into problem and hope to get some nice tips here from the community. ๐Ÿ™‚ I have two tables. Table 1 basically defines different timeranges by the columns 'Start' and 'End'...
  • AntonioM's avatar
    4 years ago

    You can do all of those steps with a measure, which you use to filter Table 2. 

     

    If you use:

    Table Filter Measure = 
    var 
        _start = SELECTEDVALUE('Table'[Start])
    var 
        _end = SELECTEDVALUE('Table'[End])
    var
        _date = SELECTEDVALUE('Table (2)'[Date])
    return
        IF( _date <= _end && _date >= _start, 1,0)

     

     Then that will give you 1s for any row within the date range, when you select a row from Table

     

    You can then apply that as a filter to a visual

    Or to filter another measure, such as

    Filtered Measure = CALCULATE ( [Measure], FILTER( Table2, [Table Filter Measure] = 1 ) )