Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gmcintire
Regular Visitor

Survey Data - Calculate n-Size Where Some Surveys Are Not Filled In

Hey everybody.  I'm having a bit of a struggle with what is probably a pretty straightforward solution.  We have a model of survey data for our healthcare organization.  So the fact table would look like the following:

 

 EncounterID          SurveyID          QuestionID          WasResponsePositive?

1                             1                      1                           NULL

1                             1                      2                           NULL

1                             1                      3                           NULL

2                             1                      1                           NULL

2                             1                      2                           0

2                             1                      3                           1

 

There's many more columns, but my dilemma really focuses on these.  What we want to calculate is the number of surveys that actually were filled out (n-Size).  In the above sample of data, n-Size would be 1 because only Encounter 2 had any questions at all filled out.  The basic logic is: Per Encounter, Per Survey, are there any non-NULL values in WasResponsePositive?  The dax for this is eluding me and I would really appreciate any insight folks can provide.

 

Thank you.

1 ACCEPTED SOLUTION
gmcintire
Regular Visitor

Actually found the answer to my own question.

 

Create a calculated column:

 

EncounterID_SurveyID:= IF(ISBLANK('Table'[WasResponsePositive?]), NULL, CONCATENATE(EncounterID, SurveyID))

 

Then the measure I need is pretty easy:

 

n-Size:=COUNTDISTINCT('Table'[EncounterID_SurveyID])

View solution in original post

1 REPLY 1
gmcintire
Regular Visitor

Actually found the answer to my own question.

 

Create a calculated column:

 

EncounterID_SurveyID:= IF(ISBLANK('Table'[WasResponsePositive?]), NULL, CONCATENATE(EncounterID, SurveyID))

 

Then the measure I need is pretty easy:

 

n-Size:=COUNTDISTINCT('Table'[EncounterID_SurveyID])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.