cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Scitech Helper I
Helper I

DAX: Cost per employee

Hi,

 

I've got a simple (I think) DAX question in order to solve this problem. Here's the thing:

 

I have 4 tables: Dim_employee, Dim_department, Sales, Accounting.

 

Now, the sales in the Sales-table are connected to the Employee ID which makes it easy for me to show the Sales per Employee. However, the cost/overhead (Accounting) is connected to the Department ID (which x-employee is a part of).

 

I basicly want to make a simple table that shows sales per employee and their share of the overhead (based on the total overhead for the department, divided by the number of employees in said department). I'm using this formula:

 

=DIVIDE([Overhead];DISTINCTCOUNT(Dim_Department[EmployeeID]))

 

This works if I show it per department, but I want to show this number per employee. If I create a table with employeeID, sales and the measure above, I figure it only counts one distinct ID per employee. Now, this is technically correct I suppose, but if a department has 10 employees, I want the overhead per employee measure to show Overhead/10 (in other words, all the employees in the department should be factored in).

 

Hope this is a sufficient description of my problem. Thanks for any help in advance.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-jiascu-msft
Microsoft

Re: DAX: Cost per employee

@Scitech

 

Hi,

 

Firstly, change all the “Cross filter direction” of the relationships into “both”. Secondly, try this measure:

Measure =
DIVIDE (
    SUM ( Accounting[Overhead] ),
    CALCULATE (
        DISTINCTCOUNT ( DIM_department[Employeeid] ),
        ALLEXCEPT ( DIM_department, DIM_department[DepartmentID] )
    )
)

Best Regards!

Dale

 

 

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

View solution in original post

6 REPLIES 6
mattbrice Solution Sage
Solution Sage

Re: DAX: Cost per employee

Can you at least post model layout?  Not sure what measures to produce without knowing how all tables are related.

Scitech Helper I
Helper I

Re: DAX: Cost per employee

Sorry, hope this is of some help.

adfb.png

Microsoft v-jiascu-msft
Microsoft

Re: DAX: Cost per employee

@Scitech

 

Hi,

 

Firstly, change all the “Cross filter direction” of the relationships into “both”. Secondly, try this measure:

Measure =
DIVIDE (
    SUM ( Accounting[Overhead] ),
    CALCULATE (
        DISTINCTCOUNT ( DIM_department[Employeeid] ),
        ALLEXCEPT ( DIM_department, DIM_department[DepartmentID] )
    )
)

Best Regards!

Dale

 

 

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

View solution in original post

Microsoft v-jiascu-msft
Microsoft

Re: DAX: Cost per employee

@Scitech

 

Hi,

 

Could you tell me if your problem is solved? You can mark the right answer to help others if it's convenient for you.

 

 

Best Regards!
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
oldmancunian
Frequent Visitor

Re: DAX: Cost per employee

Yes it would be nice to get some feedback 

Highlighted
afzalphatan Resolver I
Resolver I

Re: DAX: Cost per employee

Can you show the pic of sample pivot you are using ... also with the desired results in the next column

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors