Forum Discussion
Average 1 and 0 column
Hi all,
I am needing help to work out the average for a column that just has either a 1 or 0 per row.
I am needing the daily average of the sum of all the "1" values excluding any "0" values.
I am also needing the weekly average as well of the sum of all the "1" values.
Been playing with AverageX but just can't get it to work.
Thank you.
Anon29 ,
I am not sure whether I understand your ask correct or not but can you try this by making necessary changes in the formula based on your dataset?
Average of 1s = VAR _sumof1s = CALCULATE( SUM('Average Test Table'[Values]), 'Average Test Table'[Values] = 1) VAR _countoftotal1s = CALCULATE( SUM('Average Test Table'[Values]), 'Average Test Table'[Values] = 1,ALL('Average Test Table')) RETURN DIVIDE(_sumof1s,_countoftotal1s)Thanks,
Arul
3 Replies
- Anon29
Helper II
Yep that is right if I am looking at just the 1 day. If I was to look at say 2 days, then I'd be dividing by the sum by 2.
- Arul
Super User
Anon29 ,
I am not sure whether I understand your ask correct or not but can you try this by making necessary changes in the formula based on your dataset?
Average of 1s = VAR _sumof1s = CALCULATE( SUM('Average Test Table'[Values]), 'Average Test Table'[Values] = 1) VAR _countoftotal1s = CALCULATE( SUM('Average Test Table'[Values]), 'Average Test Table'[Values] = 1,ALL('Average Test Table')) RETURN DIVIDE(_sumof1s,_countoftotal1s)Thanks,
Arul