Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Issue comparing MIN and MAX date range slicer with table dates

Hello everyone,

 

I'd like to show all the lines which have an overlap period with the selected periode on the slicer.

I know I used to succeed this before, but I'm not able to find it back and I'm failing doing it again.

This version is a simplified version of the final behaviour, but this is where something is going wrong.


In this example, I'm trying to get a 1 flag for eah line that has the Date_debut between the dates selected in the slicer.

Showing the MIN and MAX part of the slicer in a measure works fine.

But as soon as I'm refering to a line, I'm losing the values of the slicer, what am I doing wrong?

For the 1st line : 01/07/2022 IS NOT <= 13/05/2022, but it keeps returning 1

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    My coworker disabled the relation between the slicer and the table...
    Never mind, sorry for the inconveniance !

3 Replies

  • Your Max slicer says 11/07/2023 in the details

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Please try below steps:

    1. below is my test table

    Table:

    Date:

    create with below dax formula

    Date = CALENDAR(DATE(2020,01,01),DATE(2023,01,13))

    2. create a measure with below dax formula

    Test overlap =
    VAR min_date =
        MINX ( 'Date', [Date] )
    VAR max_date =
        MAXX ( 'Date', [Date] )
    VAR cur_date =
        SELECTEDVALUE ( 'Table'[Date_debut] )
    VAR tmp =
        CALENDAR ( min_date, max_date )
    RETURN
        IF ( cur_date IN tmp, 1, 0 )
    

    3. add a slicer with "Date" table field, add a table visual with "Table" field and measure

     

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    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

    My coworker disabled the relation between the slicer and the table...
    Never mind, sorry for the inconveniance !