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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
clarainesgg
Helper I
Helper I

Calculate sales from the last 12 months comparing with the sales from the previous 12 months

Hi folks, hope you are doing well.

 

I am trying to calculate the sales from 12months  and the previous 12 months as I need to compare and analyze the trend month from a previous year vs another.

 

Thank you in advancehttps://docs.google.com/spreadsheets/d/1W2UrYHI2MCqvHQsiDfuGpyxalYLAzNiK/edit?usp=drive_link&ouid=10... 

 

 

clarainesgg_0-1734630258654.png

 

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Access Denied message.  Also, please show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Bibiano_Geraldo
Super User
Super User

Hi @clarainesgg ,

The file is protected:

Bibiano_Geraldo_0-1734632397370.png

 

 

But for last 12 months you can use this measure:

Sales_Last12Months =
CALCULATE(
    SUM(Sales[Amount]), -- Replace with your sales column
    DATESINPERIOD(
        'Date'[Date], -- Replace with your date column
        MAX('Date'[Date]), -- End date of the period
        -12, -- Number of months back
        MONTH
    )
)

 

For Previous 12 Months Sales:

Sales_Previous12Months =
CALCULATE(
    SUM(Sales[Amount]), -- Replace with your sales column
    DATESINPERIOD(
        'Date'[Date],
        MAX('Date'[Date]) - 365, -- Adjust by one year
        -12,
        MONTH
    )
)

 

Sales Trends: Absolute Difference:

Sales_Difference =
[Sales_Last12Months] - [Sales_Previous12Months]

 

Sales Trends: Percentage Change:

Sales_PercentageChange =
DIVIDE(
    [Sales_Difference],
    [Sales_Previous12Months],
    0
)

 

Hi, thank you.

However, it is not bring the result that i want to achieve (like the picture above)

 

clarainesgg_0-1734634378019.png

 

Regards,

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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