#### harivardhan

##### New Member

Hello, Thanks in advance,

The table is is as below:

In the table, I want to create a column "result" based on first three columns using POWER QUERY/

"Result" = (Quantity) * ("value in "result" that is corresponding to nearest above row that satisfies the condition ["Heirachy" of the row = "Heirachy" of the current row -1])

example: row 8:

1. formula should check all the rows above row 8 for condition

2. "heirachy" of row 8 = 3

row 7 and row 3 satisfy the condition, since their "heirachy" is (3-1=2)

3.but the nearest one is row 7, so we will take the "result" of row 7 and multiply with "Quantity" of row 8 to get the "result of row 8

example : row 14:

1. row 4, 5, 7, 8, 9, 10, 11, 13 satisfy the condition.

2. nearest is row 13. so we multiply result of row 13 and quantity of row 14 to get the result of row 14.

The table is is as below:

In the table, I want to create a column "result" based on first three columns using POWER QUERY/

"Result" = (Quantity) * ("value in "result" that is corresponding to nearest above row that satisfies the condition ["Heirachy" of the row = "Heirachy" of the current row -1])

example: row 8:

1. formula should check all the rows above row 8 for condition

2. "heirachy" of row 8 = 3

row 7 and row 3 satisfy the condition, since their "heirachy" is (3-1=2)

3.but the nearest one is row 7, so we will take the "result" of row 7 and multiply with "Quantity" of row 8 to get the "result of row 8

example : row 14:

1. row 4, 5, 7, 8, 9, 10, 11, 13 satisfy the condition.

2. nearest is row 13. so we multiply result of row 13 and quantity of row 14 to get the result of row 14.