cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Helper III

## Average of measures (maybe complex)

Hello,

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 divide by 4, etc. I only want the average of the measures that is nonblank.

In the snippet below: i need it to take the average of 4 since 2 are blank.

3 REPLIES 3
Super User

Put 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".

Helper III

Thank 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_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 ()
)
Super User

Hmm. I wonder why it's not working for you. Does this version work?

``````Average_Productivity =
VAR MeasureList = {
[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] )``````

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors