Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Using a slicer and filtering if the Number is between two numbers

I have a data table with a Start Year Column and End year Column I want to be able to Create a slicer that when I select a year it finds all rows between or equal to the start year and below or equal...
  • v-kkf-msft's avatar
    4 years ago

    Hi Anonymous ,

     

    Has your problem been solved? If it is solved, please mark a reply which is helpful to you.

     

    If the problem is still not resolved, please try the following measure:

     

    Measure = 
    VAR yearcomp =
        SELECTEDVALUE ( 'Table 2'[Year Comp 2] )
    RETURN
        IF (
            yearcomp = BLANK (),
            1,
            COUNTROWS (
                FILTER (
                    'Table 1',
                    'Table 1'[StartYear] <= yearcomp
                        && 'Table 1'[EndYear] >= yearcomp
                )
            )
        )

     

     

     Then in the visual-level filter, show items when the Measure is 1.

     

     

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.