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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ACraig08
Helper III
Helper III

Creating a Percent Change Column in Power Query

I want to add a column for percent change between Fiscal Years within each ITEM_DESCRIPTION. I have tried so many things and can't figure this out. I am getting so annoyed. I can't believe Power Query doesn't have a Previous Row function built in by!! Let alone a Percent Change function that allows you to choose the parameters. 

 

**The Percent Change column in bold is what I am trying to achieve, I just put it there so you could see what I was trying to do.

 

In Power Query I used the Group By and Index functions to get the index to restart for each ITEM_DESCRIPTION, although I don't know if that was the right thing to do or even helpful.

 

ITEM_DESCRIPTIONFiscal YearIndexAvg. Awarded PPUPercent Change
CONCRETE FOOTING (MONOTUBE)2021144290
CONCRETE FOOTING (MONOTUBE)202224396-33
CONCRETE FOOTING (MONOTUBE)202332209-2187
CONCRETE FOOTING (MONOTUBE)202441270-939
CONCRETE FOOTING (MONOTUBE)202551172-98
CONCRETE FOOTING (OVERHEAD SHAFT)2022215040
CONCRETE FOOTING (OVERHEAD SHAFT)202331162-342
CONCRETE FOOTING (OVERHEAD SHAFT)202441020-142
CONCRETE FOOTING (OVERHEAD SHAFT)2025526081588
EXTRUDED PANEL2021111930
EXTRUDED PANEL2022237142521
EXTRUDED PANEL202332378-1336
EXTRUDED PANEL2024439031525
EXTRUDED PANEL20255171-3732
MEDIAN BARRIER FOOTING (SHAFT)2023324980
MEDIAN BARRIER FOOTING (SHAFT)20244841-1657
MEDIAN BARRIER FOOTING (SHAFT)2025532262385
SIGN PANEL OVERLAY2021147540
SIGN PANEL OVERLAY20222940-3814
SIGN PANEL OVERLAY2023338872947
SIGN PANEL OVERLAY202442247-1640
SIGN PANEL OVERLAY202552820573
STRUCTURAL STEEL - BRIDGE MOUNTED TRUSS2022229550
STRUCTURAL STEEL - BRIDGE MOUNTED TRUSS2023340371082
STRUCTURAL STEEL - BRIDGE MOUNTED TRUSS202443755-282
STRUCTURAL STEEL - BRIDGE MOUNTED TRUSS202551619-2136
STRUCTURAL STEEL - I-BEAM SIGN2022228750
STRUCTURAL STEEL - I-BEAM SIGN2023342161341
STRUCTURAL STEEL - I-BEAM SIGN202441219-2997
STRUCTURAL STEEL - I-BEAM SIGN20255920-299
STRUCTURAL STEEL - MONOTUBE SIGN2021134150
STRUCTURAL STEEL - MONOTUBE SIGN202223731316
STRUCTURAL STEEL - MONOTUBE SIGN202333598-133
STRUCTURAL STEEL - MONOTUBE SIGN202442313-1285
STRUCTURAL STEEL - MONOTUBE SIGN2025541291816
STRUCTURAL STEEL - OVERHEAD SIGN POST2022228620
STRUCTURAL STEEL - OVERHEAD SIGN POST20233672-2190
STRUCTURAL STEEL - OVERHEAD SIGN POST2024422381566
STRUCTURAL STEEL - OVERHEAD SIGN POST202552590352
STRUCTURAL STEEL - OVERHEAD SIGN TRUSS202223520
STRUCTURAL STEEL - OVERHEAD SIGN TRUSS2023342033851
STRUCTURAL STEEL - OVERHEAD SIGN TRUSS202444610407
STRUCTURAL STEEL - OVERHEAD SIGN TRUSS202551933-2677
STRUCTURAL STEEL - PANEL MOUNTING POST2022249390
STRUCTURAL STEEL - PANEL MOUNTING POST202333416-1523
STRUCTURAL STEEL - PANEL MOUNTING POST202442892-524
STRUCTURAL STEEL - PANEL MOUNTING POST202552418-474

 

Can anyone please help figure this out in the simplist way possible!!! Either in Power Query or with DAX outside of Power Query.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

Column = Data[Avg. Awarded PPU]-COALESCE(LOOKUPVALUE(Data[Avg. Awarded PPU],Data[Fiscal Year],CALCULATE(MAX(Data[Fiscal Year]),FILTER(Data,Data[ITEM_DESCRIPTION]=EARLIER(Data[ITEM_DESCRIPTION])&&Data[Fiscal Year]<EARLIER(Data[Fiscal Year]))),Data[ITEM_DESCRIPTION],Data[ITEM_DESCRIPTION]),Data[Avg. Awarded PPU])

Hope this helps.

Ashish_Mathur_0-1743737371347.pngAshish_Mathur_1-1743737371611.png

 


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

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

Column = Data[Avg. Awarded PPU]-COALESCE(LOOKUPVALUE(Data[Avg. Awarded PPU],Data[Fiscal Year],CALCULATE(MAX(Data[Fiscal Year]),FILTER(Data,Data[ITEM_DESCRIPTION]=EARLIER(Data[ITEM_DESCRIPTION])&&Data[Fiscal Year]<EARLIER(Data[Fiscal Year]))),Data[ITEM_DESCRIPTION],Data[ITEM_DESCRIPTION]),Data[Avg. Awarded PPU])

Hope this helps.

Ashish_Mathur_0-1743737371347.pngAshish_Mathur_1-1743737371611.png

 


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

I broke it up into seperate columns to make it easier to calculate the percent change:

Previous Avg. = 

COALESCE(LOOKUPVALUE(Data[Avg. Awarded PPU],Data[Fiscal Year],CALCULATE(MAX(Data[Fiscal Year]),FILTER(Data,Data[ITEM_DESCRIPTION]=EARLIER(Data[ITEM_DESCRIPTION])&&Data[Fiscal Year]<EARLIER(Data[Fiscal Year]))),Data[ITEM_DESCRIPTION],Data[ITEM_DESCRIPTION]),Data[Avg. Awarded PPU])

 Change = Average - Previous Avg.

% Change = Change / Previous Avg.

 

Your code was helpful, thank you.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Sebaslop90
Regular Visitor

Hey ACraig08,

 

I found a little tricky way to do this from power query, I hope I can explain myself good enough.

 

  • Duplicate your original table
  • On the original table add a new Index Column starting from 0.
  • On the duplicated table add a new Index Column starting from 1.
  • Now on the original table you can go to Combine tables and you use the new index as key to join them, on the original table you have your row 2 as 1, but on the duplicated one you have the row 2 as 1 so you can combine them and expand the avg ppu column moved one row.
  • Just delete the New Index and you should be good to go
    Sebasop90_1-1743734524595.png


    I hope this helps 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.