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

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

Reply
Hart1969
Regular Visitor

Power Query compute a value based on previous row value

Hello,

I want to have a solution for the following problem:

Ich have several releases (e.g. 22.1, 22.2, 22.3, 22.4, 23.1, 23.2,23.3).

In each release i have a "needed capacity" and a "available capicity".

Now i want to compute the columns surplus and backlog from these values:

Example:

Releaseneeded capacityavailable capicitysurplusbacklogdescription
22.13530555 days remaining in backlog
22.2453015205 day from last release plus 15 days from current release remaining in backlog
22.32030-101010 days are free in current release reducing the backlog by 10
22.41030-20020 days are free in current release reducing the backlog to 0 (because backlog cannot be negative)
23.14530151515 days remaining in backlog
23.21030-20020 days are free in current release reducing the backlog to 0 (because backlog cannot be negative)
23.34030101010 days remaining in backlog
23.42530555 days are free in current release reducing the backlog by 5

  

The surplus column ist just "needed capacity - available capacity"

The problem is calculating the backlog. It must compute the backlog from the previous step: if ([backlog previous step] + [surplus] > 0 then [backlog previous step] + [surplus] else 0)

so it must compute how much effort of the backlog will be processed with this release. but the backlog can not be lower than 0.

 

How do i solve this problem with power query?

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

Hi @Hart1969 ,

 

You can add calculated columns to get results

vjialluomsft_0-1669630732290.png

 

 

Final output:

vjialluomsft_1-1669630732291.png

 

 

Best Regards,

Gallen Luo

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
Mikelytics
Resident Rockstar
Resident Rockstar

HI @Hart1969 

 

Is each release one row or can be one release in multiple rows?

Have you thought about the following (should work if one release is one row)? 

1) Make sure that your list sorted ascending by release ID

2) create an index column (standard Power QUery function) -> now each row should have a unique numeric index

3) now create a custom column like previousIndex = [Index] -1 

4) now create a self join based on [previous index] and [index]

5) now you should have the previous list row in each row and you can expand the information you need for further transformation.

Best regards

Michael

-----------------------------------------------------

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

@ me in replies or I'll lose your thread.

-----------------------------------------------------

LinkedIn

 

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!
v-jialluo-msft
Community Support
Community Support

Hi @Hart1969 ,

 

You can add calculated columns to get results

vjialluomsft_0-1669630732290.png

 

 

Final output:

vjialluomsft_1-1669630732291.png

 

 

Best Regards,

Gallen Luo

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors