Forum Discussion
Anonymous
8 years agoNot applicable
How to calculate average value with null values
My query is related to handling null values in calculating the average at row level. Suppose we have 4 columns. COL1 COL2 COL3 COL4 11 12 11 NULL 24 22 NULL 33 44 NULL NULL 44 55 NULL NULL 55 M...
- 8 years ago
Hey,
I used this DAX statement to create a "calculated column"
the average = var theTable = UNION( ROW("value",'Table1'[Column1]) ,ROW("value",'Table1'[Column2]) ,ROW("value",'Table1'[Column3]) ,ROW("value",'Table1'[Column4]) ) var theSum = 'Table1'[Column1] + 'Table1'[Column2] + 'Table1'[Column3] + 'Table1'[Column4] var theDivisor = COUNTROWS( FILTER( theTable ,[value] <> BLANK() ) ) return DIVIDE(theSum, theDivisor, BLANK())All the columns have a numeric data tape like decimal.
I create a table from the columns that have to be considered using UNION(ROW(...),...)
I create a simple sum from the values of in the columns that have to be considered
I count the non empty rows in the table.
Based on my sample data this will retrun these results:
Hopefully this is what you are looking for,
Regards,
Tom
Anonymous
8 years agoNot applicable
Anonymous
8 years agoNot applicable
Hi,
when i added "the average" calculated column into report, i validated data and feel it is coming incorrectly bcoz of getting disable of Don't summarize option.
Could you please help me on how to enable Don't summarize option under value field.
If you screenshot attached, will understand clearly. Thanks.