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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Commons94
Frequent Visitor

Result of Lookupvalue from the same column

Following is the sample dataset. The result columns is where the results from above rows must be filled in.

I do know how this can be done in Excel but can't find a way to do it in power BI.

the procedure to find the results is to check for value 'No' in 'Column A', when true, the lookup function needs to occur. The lookupfunction should proceed like this: if the value in 'Column A' is true (= "NO") then the corresponding value in 'column E' should be searched in 'Column D'. when there is a match the respective values from 'Result date column' and 'Result qty column' must be entered where the 'Column A' value is true.

In excel the formula would be: = IF(A9="NO",XLOOKUP(E9,D:D,B:C)). Suggestions would be most welcome. thanks in advance.

Column AResult date columnResult qty columnColumn DColumn E
Initial Value04/08/2022154X1 
   X2 
   X3 
   X4 
   X5 
   X6 
   X7 
NO04/08/2022154Y1X1
NO04/08/2022154Y1X1
   Y3X3
   Y4X4
   Y5X5
   Y6X6
   Y7X7
   Y8X8
1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Commons94 ,

 

 

Here are the steps you can follow:

1. Create calculated column.

Column =
IF(
    'Table'[Column A]="NO",
    MAXX(
        FILTER(ALL('Table'),'Table'[Column E] in SELECTCOLUMNS('Table',"D",'Table'[Column D])&&
        'Table'[Column E]=EARLIER('Table'[Column E])
        ),
        [Column B]),BLANK())

2. Result:

vyangliumsft_0-1688714873409.png

 

 

Best Regards,

Liu Yang

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

6 REPLIES 6
Commons94
Frequent Visitor

Thanks a lot for your help. Column B is the result column, I guess this can't be done on Power BI.

v-yangliu-msft
Community Support
Community Support

Hi  @Commons94 ,

 

 

Here are the steps you can follow:

1. Create calculated column.

Column =
IF(
    'Table'[Column A]="NO",
    MAXX(
        FILTER(ALL('Table'),'Table'[Column E] in SELECTCOLUMNS('Table',"D",'Table'[Column D])&&
        'Table'[Column E]=EARLIER('Table'[Column E])
        ),
        [Column B]),BLANK())

2. Result:

vyangliumsft_0-1688714873409.png

 

 

Best Regards,

Liu Yang

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

Mahesh0016
Super User
Super User

@Commons94 Please can you share ENDOUTPUT in table.

@Mahesh0016  I have provided here an elaborated sample dataset, is this somewhat helpful? thanks again!

Column AColumn BColumn CColumn DColumn E
 04/08/2022154X1 
 10/08/2022256X2 
 11/09/202268X3 
 22/10/2022126X4 
 05/11/2022550X5 
 08/12/2022119X6 
 15/01/2023154X7 
NO04/08/2022154Y1X1
NO04/08/2022154Y1X1
NO11/09/202268Y3X3
NO22/10/2022126Y4X4
NO05/11/2022550Y5X5
NO08/12/2022119Y6X6
NO15/01/2023154Y7X7
   Y8X8
NO04/08/2022154Z1Y1
   Z2Y2
NO11/09/202268Z3Y3
NO22/10/2022126Z4Y4
NO05/11/2022550Z5Y5
NO08/12/2022119Z6Y6
NO15/01/2023154Z7Y7
   Z8Y8
   Z9Y9
   Z10Y10
Mahesh0016
Super User
Super User

@Commons94 
Result_Date_Column = IF(Table[Column A] = "NO",

LOOKUPVALUE(Table[Column E],Table[Column D],Table[Date_Column]))

Result_qty_column = IF(Table[Column A] = "NO",

LOOKUPVALUE(Table[Column E],Table[Column D],Table[QTY_Column]))

 
@Commons94 i hope this helps if this not help Please share your ENDOUTPUT.

@Mahesh0016 Thanks for your quick reply. when there is a match in the if statement and with the lookup function, I need to extract the value from the result date column itself. Hence, I'll be running a loop in the result date column itself. hope it helps in understanding the problem.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.