Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Puja
Helper III
Helper III

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 3
Mahesh0016
Super User
Super User

@Puja please try this

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

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

 

 

 

@Puja please Can you first tell me code working or not.Thank you.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.