Forum Discussion

benjellounm's avatar
benjellounm
Regular Visitor
5 years ago
Solved

Filter based on date slicer

Hello,    I have this complicated task and I hope someone can help me, I have this table where I have "Company name" & "Award Date", and I want to add a column where it shows which date is the late...
  • v-kelly-msft's avatar
    5 years ago

    Hi  benjellounm ,

     

    First create a calendar table as below:

    Calendar = CALENDAR(MIN('Table'[Award Date]),MAX('Table'[Award Date]))

    Then create a measure as below:

    Measure =
    VAR _maxdate =
        CALCULATE (
            MAX ( 'Table'[Award Date] ),
            FILTER (
                ALL ( 'Table' ),
                'Table'[Award Date] >= MINX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] )
                    && 'Table'[Award Date] <= MAXX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] )
                    && 'Table'[Company name] = MAX ( 'Table'[Company name] )
            )
        )
    RETURN
        IF (
            MAX ( 'Table'[Award Date] )
                > MAXX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] ),
            BLANK (),
            IF ( MAX ( 'Table'[Award Date] ) = _maxdate, "Yes", "No" )
        )
    

    And you will see:

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!