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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Syndicate_Admin
Administrator
Administrator

Calculate percentage change between 2 fields in the same column

Hello, I need to calculate the percentage change of the column "2022" on "2021". Both columns with part of the same field that is called "Year".

Thanks a lot

Smasague_1-1666008101713.png

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

I think your data maybe like this:

vyadongfmsft_0-1666580780726.png

 

Create a new column to calculate the percentage change of the column "2022" on "2021":

 

Percentage = 
var year_2021 = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year] = 2021 && 'Table'[ID] = EARLIER('Table'[ID])))
var year_2022 = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year] = 2022 && 'Table'[ID] = EARLIER('Table'[ID])))
return
DIVIDE(year_2022 - year_2021,year_2021)

 

vyadongfmsft_1-1666580932376.png

 

I think this is the result you want:

vyadongfmsft_2-1666580968477.png

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yadongf-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

 

I think your data maybe like this:

vyadongfmsft_0-1666580780726.png

 

Create a new column to calculate the percentage change of the column "2022" on "2021":

 

Percentage = 
var year_2021 = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year] = 2021 && 'Table'[ID] = EARLIER('Table'[ID])))
var year_2022 = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Year] = 2022 && 'Table'[ID] = EARLIER('Table'[ID])))
return
DIVIDE(year_2022 - year_2021,year_2021)

 

vyadongfmsft_1-1666580932376.png

 

I think this is the result you want:

vyadongfmsft_2-1666580968477.png

Best regards,

Yadong Fang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

VahidDM
Super User
Super User

Hi @Syndicate_Admin  
@Smasague 

 

Can you post sample data as text?

please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables

Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.