Forum Discussion

blindeye's avatar
blindeye
Icon for Advocate II rankAdvocate II
8 years ago
Solved

Identify dates in the last/previous month

I'm trying to create a column that will identify a date that is in the month prior to the current month.   I have a calculated column that returns a "Yes" if the date is in the current month as fol...
  • v-yulgu-msft's avatar
    8 years ago

    Hi blindeye,

     

    Please try this measure:

    Count Dates =
    IF (
        MONTH ( TODAY () ) = 1,
        CALCULATE (
            COUNT ( 'Ops Data'[Closed Date] ),
            FILTER (
                'Ops Data',
                'Ops Data'[Closed Date].[Year]
                    = YEAR ( TODAY () ) - 1
                    && 'Ops Data'[Closed Date].[MonthNo] = 12
            )
        ),
        CALCULATE (
            COUNT ( 'Ops Data'[Closed Date] ),
            FILTER (
                'Ops Data',
                'Ops Data'[Closed Date].[Year] = YEAR ( TODAY () )
                    && 'Ops Data'[Closed Date].[MonthNo]
                        = MONTH ( TODAY () ) - 1
            )
        )
    )

    Best regards,
    Yuliana Gu