Forum Discussion
Using distinct values instead of the average in calculations
Team
I am trying to create analysis that compares forecasted billable hours to actual billable hours and provide a variance. I'm having issues with my Forecasted Billable hours metric because I have employees staffed on 2 or more projects with different billable rates for each project.
.Forecasted Hours Measure = sum('Forecast'[Forecasted Hours])
.Forecasted Revenue = [.Forecasted Hours Measure]* AVERAGE('Bill Rate'[Billable_rate])
Currently, Forecasted revenue is calculated by taking the sum of the Forecasted Hours column and multiplying it by the "average" of the Bill Rates column. I used average because within the Bill rate table is a billable rate column that has the rate duplicated many times. Its duplicated many times because it's a referencing its source, the Actual hours table, where a row is created every time my employees log an hour. Bill Rate (column) is part of the Actual hours metadata.
I used "average" so that PowerBi would "average" the records together and not sum them and skew the numbers. What I actually want is to somehow ignore duplicates. I don't want a weighted average.
My problem reveals itself when I try to report Forecasted Revenue. My forecasted revenue number is calculated based on the average Billable rates of all the projects an employee is staffed on and the number of hours they forecast. Right now, It doesn't look at each project as a distinctly separate bill rate. It averages all of the bill rates by the person. I don't want that.
For example.
Person 1 could be staffed on Project A and Project B. Project A has a bill rate of $50 dollars an hour and Project B has $100 dollars an hour. If Person 1 forecasts to work 10 hours for both projects in a week, I'd expect my forecast to be $1500. But because my data is set up such that bill rate is grabbed when hours are entered I could have an instance where there are 3 Project A entries and 1 Project b entry and the system thinks my bill rate is 62.5 for a forecasted revenue of 1250.
I don't know how to get the system to only look at the distinct values. Do you have an idea of how I should think about this?
22 Replies
- v-xicai
Community Support
Hi Anonymous ,
You can try to create measures like DAX below, assuming every person has an employee ID.
.Forecasted Hours Measure= CALCULATE(SUM('Forecast'[Forecasted Hours]),FILTER(ALLSELECTED('Forecast'), 'Forecast'[Employee.ID] =MAX('Forecast'[Employee.ID])&&'Forecast'[Project.name] =MAX('Forecast'[Project.name])))
.Forecasted Revenue = [.Forecasted Hours Measure]* CALCULATE(SUM('Bill Rate'[Billable_rate]),FILTER(ALLSELECTED('Forecast'), 'Forecast'[Employee.ID] =MAX('Forecast'[Employee.ID])&&'Forecast'[Project.name] =MAX('Forecast'[Project.name])))
Or could you please share your sample data or desired output screenshots for further analysis? You can also upload sample pbix to OneDrive and post the link here. Do mask sensitive data before uploading.
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Is there an easy method to mask sensitive data? My pbix has thousands of lines of sensitive data... I'm not sure how to share it without hours spent changing the data. Are you aware of a tool that does it?
- v-xicai
Community Support
Hi Anonymous ,
You can create your sample data such as 1,2,3,,etc on, especially to show the fields, tables and the relationships between these key tables in excel screenshot or in pbix file.
Best Regards,
Amy