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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Darko_Giac
Helper II
Helper II

Creating a Grouping Within IDs with DAX

Hi all,

 

I'm working with a fairly large survey data set and am just struggling slightly with finding a way to categorize respondents into certain groups depending on their response choice.

 

The response options include ADHD, OCD, VisualImpairment, MotorImpairment, Dysgraphia, and Dyslexia. 

 

The respondents might have duplicate rows, so I would like to categorize any respondent who chose either ADHD or OCD into Group 1, and respondents who chose anything else into Group 2 (using DAX)

 

I know I need to use the Filter function, but not quite sure how to nest it.

 

I've attached a workbook which will hopefully provide further clarity.

 

 

TestWorkbook

 

Any help/advice is greatly appreciated!

Currently using Office 365 ProPlus

 

Darko

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Darko_Giac

 

You can use a column like

 

Column =
IF (
    CALCULATE (
        DISTINCTCOUNT ( Table1[DxGrouping] ),
        ALLEXCEPT ( Table1, Table1[ID] ),
        Table1[DxGrouping] IN { "ADHD", "OCD" }
    ),
    "Group 1 & 2",
    "Group 2"
)

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

 

I am assuking that Column1 shows your expected result.  What does Group 1 & Group 2 mean? Why is Student 1 falling under Group 1 & Group 2?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Zubair_Muhammad
Community Champion
Community Champion

@Darko_Giac

 

You can use a column like

 

Column =
IF (
    CALCULATE (
        DISTINCTCOUNT ( Table1[DxGrouping] ),
        ALLEXCEPT ( Table1, Table1[ID] ),
        Table1[DxGrouping] IN { "ADHD", "OCD" }
    ),
    "Group 1 & 2",
    "Group 2"
)

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.