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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
artfulmunkeey
Helper I
Helper I

Help with LOOKUP?

Hi all, I am relatively new and struggling with what I believe should be quite straightforward, but no end of tutorials seem to be helping me as I get various syntax errors 😕

 

I have two tables: Planned Hours sorted by project and date, and HoursBooked, also sorted by project and date (in realtiy this table also contains resourcecodes and projectcode, but for simplicity I have grouped by project for now).

 

HoursBooked
ProjectCodeTimeByDayHoursBooked
3000101/01/202050
3000101/02/2020100
3000101/04/2020150
3000101/07/202075
3000201/02/2020100
3000201/03/2020200
3000201/06/2020150
3000301/01/202050
3000301/04/202075
3000301/05/202025

 

PlannedHours
ProjectNameTimeByDayPlannedHours
3000101/01/202050
3000101/02/2020100
3000101/03/2020100
3000101/04/2020100
3000101/05/2020100
3000101/06/2020100
3000101/07/2020100
3000101/08/202050
3000101/09/2020100
3000101/10/2020150
3000101/11/202050
3000101/12/2020100
3000201/01/202050
3000201/02/2020100
3000201/03/2020150
3000201/04/202050
3000201/05/2020100
3000201/06/2020100
3000201/07/2020100
3000201/08/2020100
3000201/09/2020100
3000201/10/2020100
3000201/11/202050
3000201/12/202050
3000301/01/2020100
3000301/02/2020100
3000301/03/2020100
3000301/04/2020100
3000301/05/2020100
3000301/06/2020100
3000301/07/2020100
3000301/08/202050
3000301/09/202050
3000301/10/2020100
3000301/11/2020100
3000301/12/2020150

 

I am attempting to lookup the actual hours based on project ID, and match it to the planned hours by month in the original table.

 

Something like the following, so that I can then calculate remaining hours.

 

Merged Table (LOOKUP)
ProjectNameTimeByDayPlannedHoursHoursBooked
3000101/01/20205050
3000101/02/2020100100
3000101/03/20201000
3000101/04/2020100150
3000101/05/20201000
3000101/06/20201000
3000101/07/202010075
3000101/08/2020500
3000101/09/2020100 
3000101/10/2020150 
3000101/11/202050 
3000101/12/2020100 
3000201/01/2020500
3000201/02/2020100100
3000201/03/2020150200
3000201/04/2020500
3000201/05/20201000
3000201/06/2020100150
3000201/07/20201000
3000201/08/20201000
3000201/09/2020100 
3000201/10/2020100 
3000201/11/202050 
3000201/12/202050 
3000301/01/202010050
3000301/02/20201000
3000301/03/20201000
3000301/04/202010075
3000301/05/202010025
3000301/06/20201000
3000301/07/20201000
3000301/08/2020500
3000301/09/202050 
3000301/10/2020100 
3000301/11/2020100 
3000301/12/2020150 

 

RemainingHours
ProjectTotalPlannedHoursTotalHoursBookedRemainingHours
300011100375725
300021050450600
3000311501501000

 

Any help would be greatly appreciated, thanks!

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @artfulmunkeey 

 

Believe the best option is to create two dimension tables a project code and a calendar. Then make relationship between these two tables and the other two:

MFelix_0-1600082004940.png

Now create the following measures:

HourBooked = SUM('Hours Booked'[HoursBooked])

HoursPlanned = SUM(HourPlanned[PlannedHours])

RemainingHours = [HoursPlanned] - [HourBooked]

 

Now if you use the calendar and the projects table in your visualizations alongside with your dimension tables you can create the calculations in any way needed:

MFelix_1-1600082315482.png

 

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
v-diye-msft
Community Support
Community Support

Hi @artfulmunkeey 

 

If the above posts help, please kindly mark it as a answer to help others find it more quickly. thanks!

If not, please kindly elaborate more.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
MFelix
Super User
Super User

Hi @artfulmunkeey 

 

Believe the best option is to create two dimension tables a project code and a calendar. Then make relationship between these two tables and the other two:

MFelix_0-1600082004940.png

Now create the following measures:

HourBooked = SUM('Hours Booked'[HoursBooked])

HoursPlanned = SUM(HourPlanned[PlannedHours])

RemainingHours = [HoursPlanned] - [HourBooked]

 

Now if you use the calendar and the projects table in your visualizations alongside with your dimension tables you can create the calculations in any way needed:

MFelix_1-1600082315482.png

 

Check PBIX file attach.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Excellent, many thanks for your help!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors