Forum Discussion

Chedva's avatar
Chedva
Helper II
6 years ago
Solved

Current month forecast

Hi, I have a consolidated forecast table that has SF month - the month the forecast was done, month - the month of the forecast & forecats QTY.   Ex;  SF month - Jan 2020 , Month - Dec 2020,  - t...
  • Greg_Deckler's avatar
    Greg_Deckler
    6 years ago

    Perhaps:

     

    Measure = 
      VAR __Forecast = CALCULATE(sum('Forecast Consol'[Forecast QTY]),USERELATIONSHIP('Forecast Consol'[SF Month],'Dates Slicer'[DateKey])))
      VAR __LastMonth = <calculate what your last month's date is, not entirely sure how to do this with the information provided. If you had an actual date field, this would be relatively easy>
    RETURN
      IF(
        ISBLANK(__Forecast),
        CALCULATE(sum('Forecast Consol'[Forecast QTY]),'Forecast Consol'[SF Month]=__LastMonth),
        __Forecast
      )