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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Formula Help - Filter by Another Column

I am trying to write the following formula with the following tables

Numerator should be the (Sum of Total Person Hours) - (Sum of Total Person Hours where Hour Type equals Non-Working)

Denominator should be the (Sum of Total Working Hours).

 

Using this example, the formula should be (40-24) / (40) = 0.4

 

How can I write this formula as a column or measure?

 

Table: Time Logged

Resource NamePerson HoursHour Type
Jill8Client
Jill8Internal
Jill24Non-Working

 

Table: Resources

Resource NameWorking Hours
Jill40
2 REPLIES 2
FreemanZ
Super User
Super User

or you can plot the Resource Name from Resource table with a measure like:

Measure = 
VAR _nonworkinghours= 
SUMX(
    FILTER(
        TimeLogged,
        TimeLogged[Resource Name] = MAX([Resource Name])
            &&TimeLogged[Hour Type] = "Non-Working"
    ),
    TimeLogged[Person Hours]
)
RETURN
DIVIDE( MAX([Working Hours]) - _nonworkinghours, MAX([Working Hours]))

 

it worked like:

FreemanZ_2-1676818947912.png

 

FreemanZ
Super User
Super User

hi @Anonymous 

try to add a column in the Resource table:

 

 

column = 
VAR _nonworkinghours= 
SUMX(
    FILTER(
        TimeLogged,
        TimeLogged[Resource Name] = [Resource Name]
            &&TimeLogged[Hour Type] = "Non-Working"
    ),
    TimeLogged[Person Hours]
)
RETURN
DIVIDE( [Working Hours] - _nonworkinghours, [Working Hours])

 

it worked like:

FreemanZ_1-1676818862313.png

 

 

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 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.

Top Solution Authors
Top Kudoed Authors