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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jay_diehl
Regular Visitor

Total hours without employee duplicating

Hi,

 

My datamodel is set up as followed for the dimensions:

Dim_project

ProjectIDProject
1Test

 Dim_employee

EmployeeIDName
1Hans
2Kees
3Henk

Fact tables;

Fct_Forecast

ProjectIDEmployeeIDForecastedHours
1110

Fct_Costs

ProjectIDEmployeeIDWorkedHours
112
125
134

 

Now I want to achieve the following result on my dashboard:

ProjectNameForecastTotal hours spent
TestHans1011

Because the employee is linked to costs table the value I get is the following:

ProjectNameForecastTotal hours spent
TestHans102

These are the hours that are booked by the employee Hans. I tried using all function as follows (Total hours spent = calculate(SUM('Fct_costs'[Workedhours]), All(Dim_employee[EmployeeID]))

but this resulted in the following table:

ProjectNameForecastTotal hours spent
TestHans1011
TestKees 11
TestHenk 11

How do I remove those rows for Kees and Henk and do I keep the employee name in my visual? I need to see who made the forecast. I first thought of making a measure to use as a flag when the forecast column is blank then 0 else 1 and then filter this value to be 1. This will not work because there are projects created by employees without a forecast. Anybody else has an idea how I can the employee name in the visual with the total hours for the project without the other employee names who booked the hours?

 

Thx

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @jay_diehl 

please try

spent =
IF (
NOT ISEMPTY ( Fct_Forecast ),
CALCULATE ( SUM ( 'Fct_costs'[Workedhours] ), ALL ( Dim_employee[EmployeeID] ) )
)

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @jay_diehl 

please try

spent =
IF (
NOT ISEMPTY ( Fct_Forecast ),
CALCULATE ( SUM ( 'Fct_costs'[Workedhours] ), ALL ( Dim_employee[EmployeeID] ) )
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors