Forum Discussion
Dom87326
Helper II
4 years ago% based on count ignoring blank()
Hello, I'm trying to build a dax formula that counts % of non discinct RespondentId by total RespondentId (ignoring blanks). The desired outcome should be like in column % of GT of Responden...
- 4 years ago
Hi,
Not 100% sure, but I will try to help :
Count Non Blank Answers =
VAR CountNonBlankAnswers=CALCULATE( COUNT( TabAnswers[RespondentId] ) , NOT ISBLANK( TabAnswers[Answer] ) )
RETURN
CountNonBlankAnswersWill give you the count of answers not blank. Then if you want to count each type of answer, this would do the job :Count Non Blank Answers / Answer =
VAR CurrentAnswer= SELECTEDVALUE( TabAnswers[Answer] )
VAR CountNonBlankAnswers=CALCULATE( COUNT( TabAnswers[RespondentId] ) , NOT ISBLANK( TabAnswers[Answer] ) , TabAnswers[Answer] = CurrentAnswer )
RETURN
CountNonBlankAnswersThen if those are the count you need, you'll just have to divide :% of answers = DIVIDE ( Count Non Blank Answers , Count Non Blank Answers / Answer , 0 )and get that :Hope it helps
AilleryO
Memorable Member
4 years agoHi,
Not 100% sure, but I will try to help :
Count Non Blank Answers =
VAR CountNonBlankAnswers=CALCULATE( COUNT( TabAnswers[RespondentId] ) , NOT ISBLANK( TabAnswers[Answer] ) )
RETURN
CountNonBlankAnswers
Will give you the count of answers not blank. Then if you want to count each type of answer, this would do the job :
Count Non Blank Answers / Answer =
VAR CurrentAnswer= SELECTEDVALUE( TabAnswers[Answer] )
VAR CountNonBlankAnswers=CALCULATE( COUNT( TabAnswers[RespondentId] ) , NOT ISBLANK( TabAnswers[Answer] ) , TabAnswers[Answer] = CurrentAnswer )
RETURN
CountNonBlankAnswers
Then if those are the count you need, you'll just have to divide :
% of answers = DIVIDE ( Count Non Blank Answers , Count Non Blank Answers / Answer , 0 )and get that :
Hope it helps