Forum Discussion
bmarshall92
4 years agoNew Member
Grouped Count Across Multiple Columns
I'm working with a dataset of students where I need a total enrollment count based on majors. The problem is that majors are spread across multiple columns like below (fake data). Term ID Ma...
- 4 years ago
Hi bmarshall92 ,
According to your description, here's my solution.
Create a new table.
Table 2 = VAR _Major1=SUMMARIZE('Table','Table'[Major1],"Count",COUNT('Table'[Major1])) VAR _Major2=SUMMARIZE('Table','Table'[Major2],"Count",COUNT('Table'[Major2])) VAR _Major3=SUMMARIZE('Table','Table'[Major3],"Count",COUNT('Table'[Major3])) VAR _Major=UNION(_Major1,_Major2,_Major3) RETURN FILTER(_Major,[Major1]<>BLANK())Then get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
smpa01
4 years agoCommunity Champion
bmarshall92 I meant for the data set that you provided, what is your desired output?
#1st Majors + #2nd Majors + #3rd Majors
bmarshall92
4 years agoNew Member
Oh, sorry. It'd end up something like, with 9 students with 13 majors total:
| Major | Total Enrollment |
| POL | 2 |
| BIO | 3 |
| MSC | 1 |
| EXS | 2 |
| EDU | 1 |
| SOC | 2 |
| BSAD | 1 |
| SPE | 1 |