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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Multiple table relationships - associating job numbers to multiple data lines.

I have two tables: one a lookup table of project details (fairly static, updated on an ad-hoc basis) and the other weekly cost data. The project details table looks like this:

 

TableProjectLookup
Project NameJob Number 1Job Number 2Job Number 3
OneJob001Job002Job003
Two Job004Job005Job006
ThreeJob007Job008job009

 

And the Weekly cost data looks something like this:

 

TableWeeklyCostData
Job NumberCost to DateRevenue to Date
Job001£100£200
Job002£150£180
Job003£120£90
Job004£180£170

 

I've been trying for a while to create a column/measure that would allow me to simply display the total cost per project - i.e. for each project it needs to look up three seperate job numbers from the weekly cost table (Total cost for Project One would be sum of costs for Job1+Job2+Job3).  When I try in create relationships with tables I get myself confused with the fact that I can only seem to relate a job number to a single column so not sure how to create a relationship where it can look up all three.

 

I wonder if someone might provide a few hints/tips for functions to use?  

 

many thanks

4 REPLIES 4
parry2k
Super User
Super User

@Anonymous as a best practice, it will be easy if you unpivot your project table.

 

- transform data
- select project column table
- right-click, unpivot other columns it will add two columns, attribute, and value, rename these as per your requirement
- close and apply

set relationship between your project table and job cost table and job cost will be on one side of the relationship in one to many relationship, from here you can easily calculate the cost of your projects and slice and dice the data by project or job number.

 

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.

Anonymous
Not applicable

@parry2k  appreciate the quick response!  That worked but it has also broken another part of my model (not unexpected as I only gave half of the detail in the original question).  

 

I also have another table that deals with forecast cost - it looks something like this and has been unpivoted from a combined series of excel input sheets (1 sheet per resource with a simple matrix of project names versus week-end dates):

 

TableResourceForecast
Project NameWeek EndingResourceCost CentreHoursJobCost
Project 120/06/2020Person 1Cost Centre 110Job 1£50
Project 127/06/2020Person 1Cost Centre 110Job 1£100
Project 127/06/2020Person 2Cost Centre 25Job 2£100
Project 127/06/2020Person 3Cost Centre 25Job 2£100

 

Basically  Cost Centre is pulled from a Resource Lookup table (with data,rates etc for each resource) and Job was originally based on a SWITCH statement using Cost Centre (i.e. if cost centre 1 use the job number from the cost centre 1 in the (original version) of the project lookup table etc).  With the new unpivoted version of the project table I have three lines per project and therefore this method doesn't work. Is there an easy trick to solve this? 

 

I suspect this is more about how I am structuring my input data - but I can't see any easy way to do this as its almost like the Project Table is being used in two different ways if that makes sense. 

Hi @Anonymous ,

 

Or you can try to use LOOKUPVALUE function like below:

 

Measure =
LOOKUPVALUE (
    WeeklyCostData[Cost to Date],
    WeeklyCostData[Job Number], MAX ( ProjectLookup[Job Number 1] )
)
    + LOOKUPVALUE (
        WeeklyCostData[Cost to Date],
        WeeklyCostData[Job Number], MAX ( ProjectLookup[Job Number 2] )
    )
    + LOOKUPVALUE (
        WeeklyCostData[Cost to Date],
        WeeklyCostData[Job Number], MAX ( ProjectLookup[Job Number 3] )
    )

 

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

 

Best Regards,

Dedmon Dai

@Anonymous this is too hard to explain everything, one thing is for your model is not optimized and needs to be fixed to make it all work. You should follow the transformation and fix other parts of the report based on that.



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.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors