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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Stuznet1
Frequent Visitor

Calculate Sales from Previous Year Month to Date

Hi,

I'm struggling to get the Previous Year MTD calculation to work, and I'm trying to get the prior year month to date which is August 2021 only. How do I revise below formula for last year? 

 

This is my formula to the get the current MTD

CURRENT_MTD = CALCULATE(SUM(Data[Sales_Amount]), FILTER(Data, Data[FISCAL_DATE] >= DATE(YEAR(TODAY()), MONTH(TODAY()), 01)), FILTER(Data, Data[FISCAL_DATE] < TODAY()))

Here is the result

Capture.PNG

Thanks bunch

1 ACCEPTED SOLUTION
Stuznet1
Frequent Visitor

I figured it out myself

 

CALCULATE(SUM(Data[Sales_Amount]), 
                FILTER(Data, Data[FISCAL_DATE] <= DATE(YEAR(TODAY())-1, MONTH(TODAY()), DAY(TODAY()))),
                FILTER(Data, Data[FISCAL_DATE] >= DATE(YEAR(TODAY())-1, MONTH(TODAY()), 01)), 
                FILTER(Data, Data[FISCAL_DATE] < TODAY())
            )

Result

Capture.PNG

View solution in original post

1 REPLY 1
Stuznet1
Frequent Visitor

I figured it out myself

 

CALCULATE(SUM(Data[Sales_Amount]), 
                FILTER(Data, Data[FISCAL_DATE] <= DATE(YEAR(TODAY())-1, MONTH(TODAY()), DAY(TODAY()))),
                FILTER(Data, Data[FISCAL_DATE] >= DATE(YEAR(TODAY())-1, MONTH(TODAY()), 01)), 
                FILTER(Data, Data[FISCAL_DATE] < TODAY())
            )

Result

Capture.PNG

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Kudoed Authors