Forum Discussion
Count names in more than one column
- 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 + Assist4In 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.
I think what I am saying is that I would like it to be something like the below (but the below does not work):
VAR ProjectOwner =
CALCULATE(
COUNTA(LEANSavings[BriefDescriptionOfLEANProject]), LEANSavings[ProjectOwner] = 'Employee Name'[forenamesurname]
)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 + Assist4In 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.
- InterSimi8 years ago
Helper II
That is fantastic and works great. Thank you very much Greg.
- anshul11236 years ago
Helper I
Can I use this to count number of rows/Line items for each individual ? Also , If i need to add a condition to the same for eg count number of rows for each individual where column x says "Yes" this was create a measure for all individuals where column x says "yes"?
TIA