Forum Discussion

Puja's avatar
Puja
Helper III
3 years ago

Previous month with TREATAS function

Hello Experts,

I need some help with this measure.

I need to get the previous month's sales using this function.

Actual = CALCULATE([Sales], TREATAS(SUMMARIZE(FactSalesForecast,FactSalesForecast[Year SF],FactSalesForecast[Month SF]),
DimDate[Year],DimDate[Month]))

Please help...

Thanks, 

P

3 Replies

  • Puja please try this

    Actual =
    CALCULATE (
        [Sales],
        TREATAS (
            // SUMMARIZE (
            //     FactSalesForecast,
            //     FactSalesForecast[Year SF],
            //     FactSalesForecast[Month SF]
            // ),
            VALUES(FactSalesForecast[Month SF]),
            DimDate[Month]
        )
    )
    • Puja's avatar
      Puja
      Helper III

      Mahesh0016 , How this code is going to get the previous month's data? could you please explain?