DAX: How to count rows with correlations to another row? -
being new dax, having trouble formulating question , solution related counting rows question-answer pairs.
the general scenario tabular bi model models surveys having question , answer pairing 1 question may have 1 n response options. fact table's key data respondent, response. table references 'question answer' table holding answer details of answer salient data. table in turn references question table holds information question.
i trying solve query of form, how many people answered question x, did not answer question y? in other words, of people answering question 1, how many did not answer question 12?
when question not answered, there no row question response in fact table.
i have been trying create measure fact table, survey response, , believe requires calculate() operations. video @ http://msbiacademy.com/?p=3491 has promising leads, can't quite on hump, in part because creates duplicate table product subcategory , not sure if through importing table twice, , because uses userrelationship. perhaps in case import question twice doesn't make sense. not using slicers may part of difference.
the measure directed primary top level entity survey.
the environment vs 2013 tabular bi model, sql server 2012, excel 2013.
first base measure count answers in fact table.
numanswers := countrows ( factresponse )
second, explicit measure count answers questionid 1. replace hard-coded measure measure tied disconnected slicer choose particular question x.
q1answers := calculate ( [numanswers], questions[questonid] = 1 )
finally, filter subset of people did not answer question 3 (or again, disconnected slicer measure choose question y.)
didntanswerq3 := calculate ( [q1answers], filter ( values ( respondent[respondentid] ), calculate ( [numanswers], questions[questonid] = 3 ) = 0 ) )
Comments
Post a Comment