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
Anonymous
Not applicable

need help in Lookup function

Hi All,

I have data like below table 

Screenshot_7.png

I want to create "Is Predicted" Filed based on the below condition by using M query 

  • If "Actual value" is present in "Possible value" then yes else No

Screenshot_8.png

 

Sample data:

IDActual ValuePossible ValueIs Predicted
ID1ABYes
ID1AAYes
ID1ACYes
ID2EBNo
ID2EANo
ID2ECNo
ID3CBYes
ID3CAYes
ID3CCYes
1 ACCEPTED SOLUTION

@Anonymous 

 

As a custom column, you can use

"Changed Type" is just the previous step's name. You have to change it according to your last step in the Query Editor

 

=let myID=[ID] in
let mylist=Table.SelectRows(#"Changed Type",each [ID]=myID)[Possible Value]
in
if List.Contains(mylist,[Actual Value]) then "Yes" else "No"

PQy.png


Regards
Zubair

Please try my custom visuals

View solution in original post

3 REPLIES 3
v-cherch-msft
Employee
Employee

Hi @Anonymous 

You may create a calculated column with DAX as below:

Column = 
VAR a =
    CALCULATETABLE (
        VALUES ( 'Table'[Possible Value] ),
        ALLEXCEPT ( 'Table', 'Table'[ID] )
    )
RETURN
    IF ( 'Table'[Actual Value] IN a, "Yes", "No" )

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks, 

 

Is it possible in M query editor? 

@Anonymous 

 

As a custom column, you can use

"Changed Type" is just the previous step's name. You have to change it according to your last step in the Query Editor

 

=let myID=[ID] in
let mylist=Table.SelectRows(#"Changed Type",each [ID]=myID)[Possible Value]
in
if List.Contains(mylist,[Actual Value]) then "Yes" else "No"

PQy.png


Regards
Zubair

Please try my custom visuals

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.