Forum Discussion
Anonymous
7 years agoNot applicable
Average of multiple measures
Currently I use 3 measures to calculate an average percentage using a (x+y+z)/3 method. The problem I have however is that there will be no values for one of the measures in some instan...
- 7 years ago
It's the comparisons that yield the booleans . Cast them to int:
Measure = VAR Count_ = INT ( [Measure1] <> BLANK () ) + INT ( [Measure2] <> BLANK () ) + INT ( [Measure3] <> BLANK () ) RETURN DIVIDE ( [Measure1] + [Measure2] + [Measure3], Count_ )or otherwise:
Measure = VAR Count_ = IF ( [Measure1] <> BLANK (), 1, 0 ) + IF ( [Measure2] <> BLANK (), 1, 0 ) + IF ( [Measure3] <> BLANK (), 1, 0 ) RETURN DIVIDE ( [Measure1] + [Measure2] + [Measure3], Count_ )
AlB
Community Champion
7 years agoIt's the comparisons that yield the booleans . Cast them to int:
Measure =
VAR Count_ =
INT ( [Measure1] <> BLANK () )
+ INT ( [Measure2] <> BLANK () )
+ INT ( [Measure3] <> BLANK () )
RETURN
DIVIDE ( [Measure1] + [Measure2] + [Measure3], Count_ )
or otherwise:
Measure =
VAR Count_ =
IF ( [Measure1] <> BLANK (), 1, 0 )
+ IF ( [Measure2] <> BLANK (), 1, 0 )
+ IF ( [Measure3] <> BLANK (), 1, 0 )
RETURN
DIVIDE ( [Measure1] + [Measure2] + [Measure3], Count_ )
mbjerggaard
6 years agoNew Member
Hey, this works great.
Measure =
VAR Count_ =
INT ( [Measure1] <> BLANK () )
+ INT ( [Measure2] <> BLANK () )
+ INT ( [Measure3] <> BLANK () )
RETURN
DIVIDE ( [Measure1] + [Measure2] + [Measure3], Count_ )But if i want to add the ALL function to this, ignoring filtering - how would that be done?
- AlB6 years ago
Community Champion
Hi Something like
CALCULATE([Measure1], ALL (Table1) )applied to each of the measures should work. You would need to provide more details for a more accurate answer though
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers