Forum Discussion

Mith's avatar
Mith
Regular Visitor
3 years ago
Solved

Current Month vs Previous Month

Hi,   I was using the below Dax formula for current month and previous month month last 9 months and giving me the accurate answer. Today i noticed after refreshed the data, in my report for CM and...
  • Samarth_18's avatar
    Samarth_18
    3 years ago

    This should work now.

    Current month Female =
    VAR _current_month =
        MONTH ( EOMONTH ( TODAY (), -1 ) )
    VAR _current_year =
        Year ( EOMONTH ( TODAY (), -1 ) )
    RETURN
        CALCULATE (
            [Female_App],
            FILTER (
                Applicant,
                INT(MONTH ( Applicant[Added Date] )) = INT(_current_month)
                    && INT(YEAR ( Applicant[Added Date] )) = INT(_current_year)
            )
        )
    previous month Female =
    VAR _current_month =
        MONTH ( EOMONTH ( TODAY (), -2 ) )
    VAR _current_year =
       Year ( EOMONTH ( TODAY (), -2 ) )
    RETURN
        CALCULATE (
            [Female_App],
            FILTER (
                Applicant,
                INT(MONTH ( Applicant[Added Date] )) = INT(_current_month)
                    && INT(YEAR ( Applicant[Added Date] )) = INT(_current_year)
            )
        )