Forum Discussion

InterSimi's avatar
InterSimi
Icon for Helper II rankHelper II
8 years ago
Solved

Count names in more than one column

I have a table which has a number of columns where a person can be listed, e.g.   Project Owner Assisting Staff #1 Assisting Staff #2 Assisting Staff #3 Assisting Staff #4 The individual can...
  • Greg_Deckler's avatar
    Greg_Deckler
    8 years ago

    You could do something like a calculated column in your Person's table like this:

     

    LEAN Project Count = 
    
    VAR __Table = ALL(LEANSavings)
    
    VAR ProjectOwner = 
    	COUNTROWS(FILTER(__Table,__Table[ProjectOwner]='People'[Person]))
    
    VAR Assist1 = 	
            COUNTROWS(FILTER(__Table,__Table[AssistingStaff1]='People'[Person]))
    	
    VAR Assist2 = 
    	COUNTROWS(FILTER(__Table,__Table[AssistingStaff2]='People'[Person]))
    
    VAR Assist3 = 
    	COUNTROWS(FILTER(__Table,__Table[AssistingStaff3]='People'[Person]))
    
    VAR Assist4 = 
            COUNTROWS(FILTER(__Table,__Table[AssistingStaff4]='People'[Person]))
    	
    RETURN
                
            ProjectOwner + Assist1 + Assist2 + Assist3 + Assist4

    In this case, 'People' is the name of your people table and [Person] is the column with your first and last name in it. Again, this would be created as a calculated column in your "People" table.