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
LucaBSST
Regular Visitor

Calculate hours declared in advance using a measure

Hello everyone! Hope you are doing great

I have some difficulties with a business problem. I'm actually creating a report showing hours done by employees on specific phases of a job order.
I have two fact tables to do that. The first table shows the hours that must be done to conclude the job. These hours are linked to the phase (example of the structure below). The expected closing date is the date at which the phase is expected to be finished.

 

Job orderPhaseExpected closing dateHours to do
TELECOMStatistical study28 February 2022

20

TELECOMTest28 February 202240
TELECOMConstruction28 February 2022100
TELECOMDesign5 March 202260

 

The second table shows the hours declared by employees for the phases (example of the structure below).

 

Job orderPhaseEmployeeDate of executionHours done
TELECOMTestM. Scott6 February 202216
TELECOMDesignD. Schrute15 February 202210
TELECOMConstructionS. Hudson15 February 202232
TELECOMStatistical studyJ. Halpert20 February 20228


The idea is that I need a DAX measure that gives me the sum of the hours expected to be done next month ( March in the example ) but declared this month ( February in my example ). Still following the example, my measure should give me 10 hours. In other words, I simply need a measure to get the work that has been done in advance by the employees. if the expected closing date of the phase from the first table is after this month, I sum all the hours done in the second table.

The only "key" I have between these two tables is the phase. My initial idea was to first use LOOKUPVALUE (using the phase as a common column) to get the closing date and then use an IF statement saying "if the expected closing date of the phase from the first table is after this month, I sum all the hours done for that phase in the second table.

I usually find the solution but I can't get my way around it this time! Hope my explanations were clear and thank you in advance for your help :)!

 

Luca

A piece of the model

LucaBSST_0-1647009045233.png

 

2 REPLIES 2
Anonymous
Not applicable

HI @LucaBSST,

It seems like you used the date field as a relationship key to mapping two table records but they should not be suitable for these records analysis.
Id' like to suggest you take a look at the following link to know how to build the relationship between multiple fields.

Relationship in Power BI with Multiple Columns - RADACAD

Then you can simply use the relationship to calculate the diff between two table records and get the cumulative results.

Regards,

Xiaoxin Sheng

littlemojopuppy
Community Champion
Community Champion

Hi @LucaBSST can you provide some sample data to work with?

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!

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.