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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Lookup and return value based on a condition - not related tables

Hi,

 

I have a table (project part) containing the following:
project number | project part number | Project part name | Stage code

I want to add a new column to this that shows when the project part number was at stage code 40, with the period number as the value. This data can be retrieved from another table (name: stage) that has no relationship with the project part table. I also can't create a relationship between these two tables due to ambiguity.

So my table should eventually look like this:

project numberproject part number Project part nameStadium codePeriod number closure
702201002Test140202201
702201024Test250202202


I've tried everything with LOOKUPVALUE and CALCULATE but I can't figure it out.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

I have found the solution via filters. So there was no formula necessary.

Thanks for the help!

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi,

I have found the solution via filters. So there was no formula necessary.

Thanks for the help!

v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

According to your description, I create a sample.

This is Project part table.

vkalyjmsft_0-1648016300425.png

This is Stage table.

vkalyjmsft_1-1648016489707.png

In my understanding, you want to create a column in the Project part table, when the Stadium code is 40, it should be 4 in my sample. Here's my solution.

Column =
IF (
    'Project part'[Stadium code] = 40,
    LOOKUPVALUE ( Stage[Period number], Stage[Stadium code], 40 )
)

Get the result.

vkalyjmsft_2-1648016701917.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

 

Anonymous
Not applicable

Hi,

 

This didn't work. I get a error with:
the column period no. in the table d_period was not found or cannot be used in this expression.

Nicolett_0-1647599577966.png

My relations are as follow:

Nicolett_1-1647599718187.png

There is no direct relation between d_stadium and d_periode. I can't create a relationship between these two tables due to ambiguity.

Hopefully this makes it clearer what the problem is.

 

amitchandak
Super User
Super User

@Anonymous , You can get value like . Table may not be related

maxx(filter(Table2, Table2[Code] = table1[Code] ) , Table2[Value])

 

or

 

sumx(filter(Table2, Table2[Code] = table1[Code])  && Table2[col] ="A"), Table2[Value])

 

refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

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