Forum Discussion
huguest
Advocate II
8 years agoLAX count values where column b = column a
Hello, I have a Table that contains information about Parent and Child records together (ID, Parent_ID, Type, Gender). I need to add 2 columns that calculate the number of children of each gender f...
- 8 years ago
Got it huguest
Here you go
Boy = IF ( Table1[Type] = "Parent", CALCULATE ( COUNT ( Table1[Gender] ), Table1[Gender] = "Boy", ALLEXCEPT ( Table1, Table1[Parent_ID] ) ) ) Girl = IF ( Table1[Type] = "Parent", CALCULATE ( COUNT ( Table1[Gender] ), Table1[Gender] = "Girl", ALLEXCEPT ( Table1, Table1[Parent_ID] ) )
)
)
nickchobotar
Skilled Sharer
8 years ago
Do you expect to get the results in the same table in a calculated column, or it's ok to use a measure and see your results like shown below?
| Parent_ID | Boy | Girl |
| 1 | 3 | 1 |
| 2 | 2 | 2 |
N-
huguest
Advocate II
8 years agoIdeally as a calculated column in the same table.
- nickchobotar8 years ago
Skilled Sharer
Got it huguest
Here you go
Boy = IF ( Table1[Type] = "Parent", CALCULATE ( COUNT ( Table1[Gender] ), Table1[Gender] = "Boy", ALLEXCEPT ( Table1, Table1[Parent_ID] ) ) ) Girl = IF ( Table1[Type] = "Parent", CALCULATE ( COUNT ( Table1[Gender] ), Table1[Gender] = "Girl", ALLEXCEPT ( Table1, Table1[Parent_ID] ) )
)
)- huguest8 years ago
Advocate II
Thank you, I will give it a try as soon as I get a chance.