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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

Hours Expended Based on Conditions

Hello,

 

I want to calculated hours expended in my dataset based on a few conditions.

 

Example Dataset 

IDCrew SizeTime DeltaStart / FinishJob Type (Erect or Dismantle)
131StartErect
132 Erect
133 Erect
134 Erect
135 Erect
136 Erect
137FinishErect
212StartErect
212  
212  

 

The above dataset shows a task ID (1), the amount of people working on that job (3), the time spent on each entry, the entry the job was started and finished and what type of job it is (erect).

 

I want to calculate the time expended on each ID ('crew size' * 'Time Delta') based on the below conditions.

 

  • Has a "start" and a "finish" entry
  • Is an "erect" 'Job Type'

Looking at the above dataset the measure would return 84 for Job ID 1. It would return nothing for Job ID 2 as it does not contain a "finish" entry.

 

How can this be achieved?

 

 

1 ACCEPTED SOLUTION
tamerj1
Community Champion
Community Champion

Hi @Anonymous 
Here is a sample file with the solution https://www.dropbox.com/t/wsVgfD6l6EA1AjId

1.png

Time Expended = 
SUMX (
    VALUES ( Data[ID] ), 
    CALCULATE (
        VAR StartFinish1 = VALUES ( Data[Start / Finish] )
        VAR StartFinish2 = { "Start", "Finish" }
        VAR TotalTime = SUM ( Data[Time Delta] )
        VAR CrewSize = SELECTEDVALUE ( Data[Crew Size] )
        RETURN 
            IF ( 
                COUNTROWS ( INTERSECT ( StartFinish1, StartFinish2 ) ) = 2,
                CrewSize * TotalTime
            )
    )
)

View solution in original post

1 REPLY 1
tamerj1
Community Champion
Community Champion

Hi @Anonymous 
Here is a sample file with the solution https://www.dropbox.com/t/wsVgfD6l6EA1AjId

1.png

Time Expended = 
SUMX (
    VALUES ( Data[ID] ), 
    CALCULATE (
        VAR StartFinish1 = VALUES ( Data[Start / Finish] )
        VAR StartFinish2 = { "Start", "Finish" }
        VAR TotalTime = SUM ( Data[Time Delta] )
        VAR CrewSize = SELECTEDVALUE ( Data[Crew Size] )
        RETURN 
            IF ( 
                COUNTROWS ( INTERSECT ( StartFinish1, StartFinish2 ) ) = 2,
                CrewSize * TotalTime
            )
    )
)

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.