Forum Discussion

carlol's avatar
carlol
Resolver I
2 years ago

Averages Calc

Hi 

 

I want to get Average number of Procedures by Attending Doctor 

 

Sum of Procedures / Count of Attending doctors 

 

I am having issue with Suming up the count of Doctors , it is just divinding the Sum of Procedures by 1

 

Can somebody point me in the right direction , maybe a better approach or dax function to use ? 

 

TotalProceduresInclNational =
VAR total =
    CALCULATE([TotalExclAttendingDoctor],ALL(Hospital[Hospital]))
RETURN
    SWITCH(SELECTEDVALUE('Hospital'[Hospital]),"National",total,[TotalProcedures])

 

Total no. of AttendingDoctors =

VAR NumOfAttendingDoctors = CALCULATE(DISTINCTCOUNT(AttendingDoctor[AttendingDoctor]))
                                       Also tried --CALCULATE(COUNTROWS(AttendingDoctor),
AllEXCEPT(AttendingDoctor,AttendingDoctor[AttendingDoctor]))
VAR Results = NumOfAttendingDoctors

Return
Results

 

 

AverageProceduresCarriedOut =

VAR TotalProcedures = [TotalProceduresInclNational]
VAR AttentingDoctorCount = [Total no. of AttendingDoctors]
VAR Results =
DIVIDE(TotalProcedures,AttentingDoctorCount)

Return
Results