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
Amardeep100115
Post Prodigy
Post Prodigy

Lookup value from same table

Hi 

 

i wish to be have  Group Values according to ID values in power query Second ID has some values from First ID columns

 

Annotation 2020-06-16 005804.jpg

Sample Data

 

Please guide & help

AB
1 ACCEPTED SOLUTION

@Amardeep100115 solution attached using power query.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

7 REPLIES 7
v-juanli-msft
Community Support
Community Support

Hi @Amardeep100115 

If [Group] has number and text type data, please change the formula from mahoneypat as below:

Lookup Group = 
VAR __thisID2 = Table[ID2]
RETURN
    CALCULATE ( MAX( Table[Group] ), FILTER(Table ,Table[ID] = __thisID2 ))

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you! Why does this work?! I have been trying to solve a similar problem like this: 
Lookup Group =
VAR __thisID2 = Table[ID2]
RETURN
CALCULATE ( MAX( Table[Group] ), Table[ID] = __thisID2 )

and it never worked. Thank you and also I would love to understand why this makes a difference if you know it! 

i wish to be have in query editor
AB

@Amardeep100115 solution attached using power query.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

mahoneypat
Employee
Employee

You can use an expression like this in your calculated column to get your desired result.  FYI that you will not be able to have two columns with same name, so I am changing to ID2 for your second ID column:

 

Lookup Group =
VAR __thisID2 = Table[ID2]
RETURN
    CALCULATE ( AVERAGE ( Table[Group] ), ALL ( Table ), Table[ID] = __thisID2 )

 

Not sure if you have multiples rows, so I used average, but if single row for each Min, Max, Sum would also work.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


parry2k
Super User
Super User

@Amardeep100115 sorry your question is not clear, can you be more specific, what output you are looking for.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

yelllow highlighted column has first column values and i wish to have values from Group column in new column which refer the yellow highlighted ID values i. e. 

ID  Center  Group   ID Results

1        2         30       2     65

3         4        50      5      55

2        5         65      4      50

5         1         55     1      30

 

like a vlookup in excel

 

Like this 

 

 

Hope i am clear on my query, 

AB

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.