Forum Discussion
Coryanthony
Helper III
2 years agoAverage of measures (maybe complex)
Hello, Please help if all possible. I want to get the average of 6 different measures. If one of the 6 measure is blank, then it should divide by 5. If 2 of 6 measures is blank, then it should divi...
AlexisOlson
Super User
2 years agoPut the measures into a list and use AVERAGEX.
AVERAGEX ( { [ADF], [CR], [London], [Manual], [Pcard], [SNOW] }, [Value] )
Note: Technically, using { ... } creates a single-column table with the default column name "Value".
Coryanthony
Helper III
2 years agoThank you for your response AlexisOlson . Your measure did not seem to work but i figured it out below measure. thanks again.
Average_Productivity =
VAR MeasureList = {
[TOTAL_ADF_PRODUCTIVITY],
[TOTAL_CR_PRODUCTIVITY],
[TOTAL_Manual_Entries_PRODUCTIVITY],
[TOTAL_SNOW_PRODUCTIVITY],
[TOTAL_LondonTax_PRODUCTIVITY],
[TOTAL_Pcards_PRODUCTIVITY]
}
VAR NonBlankValues =
SUMX (
MeasureList,
IF (
NOT ( ISBLANK ( [Value] ) ),
[Value],
BLANK ()
)
)
VAR NonBlankCount =
COUNTROWS ( FILTER ( MeasureList, NOT ( ISBLANK ( [Value] ) ) ) )
RETURN
IF (
NonBlankCount > 0,
DIVIDE ( NonBlankValues, NonBlankCount ),
BLANK ()
)
- AlexisOlson2 years ago
Super User
Hmm. I wonder why it's not working for you. Does this version work?
Average_Productivity = VAR MeasureList = { [TOTAL_ADF_PRODUCTIVITY], [TOTAL_CR_PRODUCTIVITY], [TOTAL_Manual_Entries_PRODUCTIVITY], [TOTAL_SNOW_PRODUCTIVITY], [TOTAL_LondonTax_PRODUCTIVITY], [TOTAL_Pcards_PRODUCTIVITY] } VAR NonBlankValues = FILTER ( MeasureList, NOT ( ISBLANK ( [Value] ) ) ) RETURN AVERAGEX ( NonBlankValues, [Value] )