Forum Discussion

MONA4980's avatar
MONA4980
Frequent Visitor
1 year ago
Solved

LAST MONTHS SALES

Hello,  I am really new to Power BI and DAX. I am trying to get MOM data and have to first get my profit from last month.  Before I throw it out there know that I have a table that uses the calenda...
  • MasonMA's avatar
    1 year ago

    MONA4980 

     

    Hi, 

    1. Mark your calendar table as Date table. 
    2. Use time-based functions like 'PARALLELPERIOD' on your Calendar table.

     

    That said, update your Measure to, 

     

    LAST MONTH PROFIT =
    CALCULATE(
    SUM('ORDERS'[PROFIT]),
    USERELATIONSHIP('Calendar'[Date], 'ORDERS'[DISPDATE]),
    PARALLELPERIOD('Calendar'[Date], -1, MONTH)
    )

     

    Hope this works for you:)