Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

previous month

Hi all,   i want to calucaluate the previous month count   using  below exp not working fine   my Date field is  Calendar_date   and    values are    01-Apr-20    like that      this is my DB v...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hello,

     

    I am pretty sure that it only works with a dimension date table, so using this table your expression would be like the following:

     

    Prev Month count = CALCULATE([SKU_Count],dateadd(dim_date[.Calendar_date],-1,MONTH))

     
  • amitchandak's avatar
    amitchandak
    6 years ago

    Anonymous , not sure the name of date in date table, one of the following

    CALCULATE([SKU_Count],dateadd(dim_date[Calendar_date],-1,MONTH))

    CALCULATE([SKU_Count],dateadd(dim_date[Date],-1,MONTH))

    CALCULATE([SKU_Count],DATESMTD(dateadd(dim_date[Date],-1,MONTH)))