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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
renanpinheiro
Helper I
Helper I

calculation relating to previous years

I have a table with multiple values per company and each line represents a year.
I need to calculate a one-year value (one line) divided by another year of value (other line). But these lines has no fixed year, I have a company that has the years 2015, 2014, 2013, and others that have the years 2014, 2013, 2012 and so on.
The calculation is done by the company. Do not mix one with another company.

Can someone help me?

1 ACCEPTED SOLUTION
jessicammoss
Advocate I
Advocate I

Assuming a DataTable with columns Company, Year, and Value, and you want to get a YoY value, you can use this calculation:

 

YoY = [Value] / CALCULATE(MAX([Value]), FILTER('DataTable', EARLIER('DataTable'[Company]) = 'DataTable'[Company] && EARLIER('DataTable'[Year]) = 'DataTable'[Year] + 1))

 

This results in this output with sample data:

powerbi-yoy.png

 

HTH,

Jessica

View solution in original post

2 REPLIES 2
jessicammoss
Advocate I
Advocate I

Assuming a DataTable with columns Company, Year, and Value, and you want to get a YoY value, you can use this calculation:

 

YoY = [Value] / CALCULATE(MAX([Value]), FILTER('DataTable', EARLIER('DataTable'[Company]) = 'DataTable'[Company] && EARLIER('DataTable'[Year]) = 'DataTable'[Year] + 1))

 

This results in this output with sample data:

powerbi-yoy.png

 

HTH,

Jessica

Hi Jessica,
worked perfectly.
Pen include DIVIDE function, not to be written in the infinity values:

 

YoY = DIVIDE([Value]; CALCULATE(MAX([Value]), FILTER('DataTable', EARLIER('DataTable'[Company]) = 'DataTable'[Company] && EARLIER('DataTable'[Year]) = 'DataTable'[Year] + 1)); BLANK())


thank you so much.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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