cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
eacy
Helper II
Helper II

Query Editor - fetching value from a row where id is matching my value from my current row

Hi,

 

Here is what I'm trying to archive. This is simular to one of my previous comment.

I know that I alway at least have one [Col2] which is "true". (It is not necesary the first line)

In this situation I would like to set [Col6] equal to [Col3]

Otherwise I would like calculate [Col6] by finding the [Col6] value from the privious or next row where [Col1] is matching my current row [Col4]. THIS IS THE ESSENTIAL PART

and then add the value from [Col5]

 

	Col1	Col2	Col3	Col4	Col5	Col6
Row1 1 true 1 null null Row2 2 false 0 1 3 Row3 3 false 0 2 7

 

Col6 = if [Col2] = true then [Col3] else "take value from previous or next row [Col6] where [Col1] = [Col4] and add [Col5]"

 

	Col1	Col2	Col3	Col4	Col5	Col6
Row1	1	true	1	null	null	1	
Row2	2	false	0	1	3	4
Row3	3	false	0	2	7	11

 

Please help.

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft
Microsoft

Hi @eacy

In DAX, we can compare values in previous row by adding [index] column in table and filter table context with this column. But even based on this comparison, it’s still not possible to achieve this kind of “self recursion” to generate values in current column.

Best Regards,
Angelia

View solution in original post

1 REPLY 1
v-huizhn-msft
Microsoft
Microsoft

Hi @eacy

In DAX, we can compare values in previous row by adding [index] column in table and filter table context with this column. But even based on this comparison, it’s still not possible to achieve this kind of “self recursion” to generate values in current column.

Best Regards,
Angelia

View solution in original post

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors