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
Danny-Happy
Helper I
Helper I

Help with calculations "Revenue by employee"

I've got a question about some calculations.

 

We have several project with "Revenue" and "Hours spend" by employee.

This is what we get from our data:

 

Power BI - picture.PNG

 

But what we really would like to see is:

 

Power BI - picture 2.PNG

 

I tried to calculate the revenue by employee by: 

 

Revenue per hour = divide ( revenue , hours )

Revenue per employee = Revenue per hour * Hours

 

Unfortunately that doesn't work.

 

Can you please help us calculate the revenue by employee?

 

Thanks 🙂 

 

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hello @Danny-Happy ,

You can create measures such as DAX below.

Percent Hour= 
DIVIDE (CALCULATE(SUM(Table1[Hours]),FILTER(ALLSELECTED(Table1), Table1[Project] =MAX(Table1[Project])&&Table1[Employee] =MAX(Table1[Employee]))), 
CALCULATE(SUM(Table1[Hours]),FILTER(ALLSELECTED(Table1), Table1[Project] =MAX(Table1[Project]))))

Percent Revenue= 
DIVIDE (CALCULATE(SUM(Table1[Revenue]),FILTER(ALLSELECTED(Table1), Table1[Project] =MAX(Table1[Project])&&Table1[Employee] =MAX(Table1[Employee]))), 
CALCULATE(SUM(Table1[Revenue]),FILTER(ALLSELECTED(Table1), Table1[Project] =MAX(Table1[Project]))))

Best regards

Amy

Community Support Team _ Amy

If this post helps,then consider Accepting it as the solution to help other members find it faster.

View solution in original post

4 REPLIES 4
v-xicai
Community Support
Community Support

Hello @Danny-Happy ,

You can create measures such as DAX below.

Percent Hour= 
DIVIDE (CALCULATE(SUM(Table1[Hours]),FILTER(ALLSELECTED(Table1), Table1[Project] =MAX(Table1[Project])&&Table1[Employee] =MAX(Table1[Employee]))), 
CALCULATE(SUM(Table1[Hours]),FILTER(ALLSELECTED(Table1), Table1[Project] =MAX(Table1[Project]))))

Percent Revenue= 
DIVIDE (CALCULATE(SUM(Table1[Revenue]),FILTER(ALLSELECTED(Table1), Table1[Project] =MAX(Table1[Project])&&Table1[Employee] =MAX(Table1[Employee]))), 
CALCULATE(SUM(Table1[Revenue]),FILTER(ALLSELECTED(Table1), Table1[Project] =MAX(Table1[Project]))))

Best regards

Amy

Community Support Team _ Amy

If this post helps,then consider Accepting it as the solution to help other members find it faster.

Thank you so much, this works indeed.

But now I have some new problems with the totals.

 

Power BI - picture.PNG

 

As you can see the "Totaal" is wrong from colum % Hours, we just need the following:

Revenue Employee = Totaal revenue (17.823.115,71 so just the project totals)
Revenuevalue Employee = Totaal revenue (17.823.115,71 so just the project totals)

Is this possible?

 

Thanks

FrankAT
Community Champion
Community Champion

Hi @Danny-Happy 

with your description and sample data I get the following result. Both measures returns the same values, it's by your data:

 

23-09-_2020_14-36-01.png

 

Sum of Hours = SUM('Table'[Hours])

Sum of Revenue by Employee = SUM('Table'[Revenue by Employee])

Revenue per Employee = 
    DIVIDE([Sum of Revenue by Employee],CALCULATE([Sum of Revenue by Employee],ALL('Table')))

Revenue per Hour = 
    DIVIDE([Sum of Hours],CALCULATE([Sum of Hours],ALL('Table')))

 

With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)

Thank you for your answer.

The following measure doesn't work because in "Table" there are more Projects, so the result of the measure is all written hours:

Revenue per Hour =
DIVIDE([Sum of Hours],CALCULATE([Sum of Hours],ALL('Table')))

To show this I've made the following measure:

Revenue per Hour (basically this is all written hours no revenue) =
CALCULATE(
[hours] ,
ALL( 'Fact - post-calculation total' ) )
Solution:
Power BI - all hours.PNG
I can't use the following measure because I just have the revenue per project not per employee:
Revenue per Employee =
DIVIDE([Sum of Revenue by Employee],CALCULATE([Sum of Revenue by Employee],ALL('Table')))
I need to calculate the revenue per employee first based on written hours.

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.