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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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 Employee
Microsoft Employee

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 Employee
Microsoft Employee

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors