Forum Discussion

almudeve's avatar
almudeve
Frequent Visitor
2 years ago
Solved

Previous MTD Calculation

Dear community,   I have the following DAX for calculate the previous MTD sales and it is not working as I expected. Today is 10th March, and I need the sales from 1st February to 10th February, a...
  • almudeve's avatar
    almudeve
    2 years ago

    Hi FreemanZ ,

     

    You almost got it!!

    I have resolved it and it is close to your solution, thank you very much!!

    The solution is:

     

    Sales_PreviousMTD =
    Var _LastDate = LASTDATE(sales_table[date])
    return
    CALCULATE(
        SUM(sales_table[sales_amount]),
        DATESMTD(
            DATEADD(_LastDate),-1,MONTH)
            )
    )
     
    Hope this helps to anyone who is facing the same issue!