Forum Discussion
ryan25r9
6 years agoHelper I
Measure Efficiency -- Get distinct values, average per single date, then sum the averages
Hey everyone, I'm trying to find a way to refactor this measure to make it more efficient, since it's currently pretty slow. I've been spinning my wheels, so any help is greatly appreciated. ...
mahoneypat
6 years agoMicrosoft Employee
Thanks for providing sample data and output. This measure should work for you in a table with Dates on the rows.
NewMeasure =
VAR __summary =
ADDCOLUMNS (
SUMMARIZE ( TLG, TLG[Employee ID], TLG[Date Worked] ),
"AvgHrs", CALCULATE ( AVERAGE ( TLG[Workday Days] ) )
)
RETURN
AVERAGEX ( __summary, [AvgHrs] )
If this works for you, please mark it as solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
ryan25r9
6 years agoHelper I
Greatly appreciate the reply! Unfortunately this measure is in an SSAS tabular model, so I need it to work in all contexts and can't limit to a table with dates on the rows.