reporting services - SSRS - Counting Correct Answers and Calculating Percentages via Comparison Fails -
this first time using ssrs, gentle! i'm working on report want compare number of correct answers number of user answers group. group repeats , looks set okay, part isn't worry. it's calculation of field seems worry.
here's dataset:
topicid topicname groupscore totalpossible questionid question correctanswer groupanswerscore useranswer 1 test topic 2 1 6 when did start? 1917 1 1896 1 test topic 1 3053 1200th governor? olestra chyppin 1 brent spoon 1 test topic 2 1 3053 1200th governor? olestra chyppin 1 olestra chyppin
this query calculate percentage based on correct answers compared answers not work:
=iif(fields!useranswer.value=fields!correctanswer.value,1,0)/count(fields!useranswer.value))
likewise, query find number of correct answers doesn't work:
=iif(fields!useranswer.value=fields!correctanswer.value,1,0)
both return either 0 (if reverse order on percentage portion) or "infinity". i'd appreciate can offer!
you need aggregate of data set. in case use sum
. statement evaluates single row , unclear row. statement find total number of correct answers
=sum(iif(fields!useranswer.value=fields!correctanswer.value,1,0))
you may need include scope if have groupings in report. see ssrs documentation here more information.
Comments
Post a Comment