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
jfern78
Frequent Visitor

Calculate % difference between two years

I would like to work out % difference between 2 years for a set of values and having some trouble doing so.

 

First of all, let’s say I have the following sample of data

 

Year

Active/Inactive Sale

Deparment

2020

ActiveMontevideo
2019ActiveMontevideo
2020InactiveSalto
2020ActivePaysandu
2019InactiveSalto
2019ActiveMontevideo
2020InactiveCanelones
2019ActiveCanelones

 

The column Year is a integer number not a date value.
I need to calculate 2023 vs 2022, vs 2021 vs 2020. 

 

 

 Montevideo  Salto  
Active/Inactive Sale20192020% change20192020% change
Active23%19%-4%22%16%-6%
Inactive22%19%-3%13%21%8%
Mary24%22%-2%12%26%14%

 

I used this measure to calculate the chosen selection of the slicer

Spoiler
Measure = 
 var _sliceryear = CONCATENATEX(DISTINCT('Cartera Total'[yearslicer]),[yearslicer])
 var _converts = CONVERT(_sliceryear,INTEGER)
var _lastyear = CALCULATE(COUNTA('Cartera Total'[system_no]),FILTER(ALL('Cartera Total'),'Cartera Total'[FY Año Alta]=_converts-1 && 'Total Sales'[Active/Inactive]="Inactive"))
return _lastyear

any suggest?

 

4 REPLIES 4
some_bih
Super User
Super User

Hi @jfern78 I would recommend you to check link below, part Year-over-year growth, as this is one of the best practice. This solution require Calendar / Date table (and your data from Fact table as date type), but article is worth reading and implementation for your case. 

Hope this help, kudos appreciated.

 

https://www.daxpatterns.com/standard-time-related-calculations/ 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






i made a column with correct FY Year/date, but when i try to calculate last year sales return me blank.

jfern78_0-1694444244221.png

 

Total Sales Last Year = CALCULATE([Total Cartera Activa],dateadd('Cartera Total'[Fiscal Date],-1,Year))

jfern78_1-1694444263285.png

 

Hi @jfern78 use Date / Calendart table to "leverage" proper usage of Power BI time intelligence functions like YTD, MTD... do not put fact table year column in visual.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Thanks, i will see it. i'm figuring out how to do it.

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.