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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Simple measure formula to calculate productivity?

EERM = 
var startdate = CALCULATE(MIN(ServiceLogs[Date]))
var stopdate = CALCULATE(MAX(ServiceLogs[Date]))
VAR hourlyrate = CALCULATE(SUM(PayRates[HourlyRate]))
VAR possiblehours = CALCULATE(SUM(Dates[PossibleHours]), FILTER(Dates, Dates[Date] >= startdate && Dates[Date] <= stopdate))
var totaltime = CALCULATE(SUM(ServiceLogs[TotalTime]))
var possiblebilling = CALCULATE(SUM(Dates[PossibleBilling]))
var totalcost = MIN(Cost[Cost])
var totalbilling = totaltime * totalcost
DIVIDE(DIVIDE(hourlyrate * possiblehours, totaltime), hourlyrate) + DIVIDE(possiblebilling, totalbilling)

 

I am trying to create a measure that calculates the EERM per employee based on a date range from a slicer. 

 

The tables are basically as follows:

Dates

- Date

- IsWorkingDay

- PossibleHours = 8 if working day

- Possible Billing = Say, 100, if working day

Cost

- Cost

ServiceLogs

- TechID

- TotalTime

- Date

Reps

- RepName

- TechID

PayRates

- RepName

- HourlyRate

 

 

HourlyRate, TotalTime, and TotalCost seem to work when I return only them. I guess the problem lies with the Dates table, which has no rep to filter by? PossibleHours returns a multiple of 8, but differs for every person when it should be the same across the board? If I select 2 weeks in the data slicer it needs show 80 hours for everyone. Not worried about time off just yet.

 

The bar chart is EERM by RepName. All tables have a relationship both ways on respective field names.

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

You could create a disconnected date table, add columns from this table to the slicers,

Then create measures using the selected value from the slicer.

 

You could check the threads below:

https://www.blue-granite.com/blog/disconnected-table-power-bi

 

Best Regards
Maggie
Community Support Team _ Maggie Li
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

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

You could create a disconnected date table, add columns from this table to the slicers,

Then create measures using the selected value from the slicer.

 

You could check the threads below:

https://www.blue-granite.com/blog/disconnected-table-power-bi

 

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

Anonymous
Not applicable

Thank you! It's like a Christmas gift 😁

 

I had already created a date table, but it was not disconnected. I realized that I had the direction set to both and when I changed that to one-way it resolved some of it. That article also pointed me in the right direction to get the start and end date of the slicer using ALLSELECTED.

 

I believe it was:

 

Start Date = CALCULATE(MIN(Dates[Date]), ALLSELECTED(Dates[Date]))

End Date = CALCULATE(MAX(Dates[Date]), ALLSELECTED(Dates[Date]))

 

 

Anyway, thank you again. Have a great New Year!

parry2k
Super User
Super User

@Anonymous if you can share pbix with sample data and expected out, will help to get you the solution.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.