Counting distinct values out of two columns

In my table, I've got two columns with names in them. The names are randomly assorted into column 1 and 2 (i.e. Mr.X could be in either column). I need to be able to count the number of times each unique name appears.

I apologize if this has been rehashed. I tried searching and quickly got in over my head...

Hi @paintbb84
Create a Custom Column, which does something like this case([col1]=[col2], 1, 2) and then do a sum of that column.
https://www.metabase.com/learn/building-analytics/notebook-editor/custom-expressions.html
https://www.metabase.com/docs/latest/users-guide/expressions.html

So first off, thank you as always because I totally learned something today from your answer!! I never knew about "case" functionality!!!

I should have made my post differently. I'm trying to come up with the number of times each person's name shows up in either of the 2 columns on the list. I need something like a "show and count unique values" function. I just don't know how to get there (I'm trying to learn SQL on my own so I don't have to keep bothering you with questions. Thank you Flamber for all your help!)

@paintbb84 You would have to create something through SQL. Don't think Metabase can do that through the GUI.
Something where you combine the two columns and then have two sub-selects. If you want to learn SQL, then I would recommend that you try searching stackoverflow.com or a forum dedicated to the database you are using.

Already made my account with stack :slight_smile: Thank you for all your help! If it weren't for your help, we'd never get anywhere with metabase!!