Forum Discussion
Calculating Percentage Between 2 tables
Hi there!
Try the following measure:
VAR _TrainingLogEmployeed =
DISTINCTCOUNT( 'Training Log' )
VAR _TotalCount =
SUM( 'Total Employees'[# of Employees] )
VAR _Result =
DIVIDE( _TrainingLogEmployeed, _TotalCount )
RETURN
_Result
Let me know if it is helpful.
- jeralee24 years agoFrequent Visitor
Hi! Thanks so much for responding! I think this got me closer! But it doesn't seem to be respecting any slicer values. It's giving me the percent of entire total instead of the percent of total by state. I changed my data structure a bit and took out the grouped table and tried your method by joining just the employee table to the employees trained table:
EmployeesTrainedPercent = VAR _EmployeesTrained =DISTINCTCOUNT(MasterAttendanceTable[Email])var _TotalCount =DISTINCTCOUNT('Allocations File'[Associate ID])var _result =DIVIDE(_EmployeesTrained,_TotalCount)return_resultDo I need some kind of summarization or filter command? My slicers are coming from the same table:- PaulDBrown4 years agoCommunity Champion
Have you created the calendar table?
the measures posted in the other thread are tested and work. A simple division does not work at the total level because you need the sum of employees * the number of days. If you have locations with no activity on a particular day it will also affect the result.
If you read the other thread carefully you will see there are 3 different % calculations (all correct) computing different things. So pick the one you need and replicate the measure with your tables- jeralee24 years agoFrequent Visitor
Hi! I did read through but I noticed a CALCULATE...ALL which from another video I watched, apparently doesn't work anymore with newer versions of PowerBI Desktop. Maybe you can confirm that for me?
I also don't need to know the percentage as of a point in time. I only need the number of employees as of today, so a calendar table isn't necessary. I realize this might throw my calculation off slightly, but we aren't concerned with exacts as we have very low turnover. We just want to know how many trainees actually attended the class vs how many COULD have attended.