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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Employee
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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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