Forum Discussion

DeBIe's avatar
DeBIe
Post Partisan
3 years ago
Solved

Fix time intelligence measure

Hi all,   I am using a time intelligence measure to filter results for the current month, but I detected that it's not giving me the correct result. Since a while I also included data from previous...
  • amitchandak's avatar
    3 years ago

    DeBIe ,because you are comparing month not month year

     

    refer

     

    MTD Today =
    var _min = eomonth(today(),-1)+1
    var _max = today()
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    LMTD Today=
    var _min = eomonth(today(),-2)+1
    var _max1 = today()
    var _max = date(year(_max1),month(_max1)-1, day(_max1))
    return
    CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    LYMTD Today =
    var _min = eomonth(today(),-13)+1
    var _max1 = today()-1
    var _max = date(year(_max1)-1,month(_max1), day(_max1))
    return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    MTD Yesterday =
    var _max = today() -1
    var _min = eomonth(_max,-1)+1
    return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    This Month Today =
    var _min = eomonth(today(),-1)+1
    var _max = eomonth(today(),0)
    return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    Last Month Today =
    var _min = eomonth(today(),-2)+1
    var _max = eomonth(today(),-1)
    return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

    Same Month Last Year Today =
    var _min = eomonth(today(),-13)+1
    var _max = eomonth(today(),-12)
    return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))