Forum Discussion
Anonymous
4 years agoNot applicable
Create a new column based on multiple columns and grouping
Hi, I need to create a new column based on family members under 1 employee code. Below is the data that I have and column that I need to create ie Family Definition As can be seen f...
- 4 years ago
Hi,
Please check the below Calculated Column DAX formula and the attached pbix file.
It is for creating a calculated column.
Family definition CC = VAR _conditiontable = SUMMARIZE ( FILTER ( Data, Data[Year] = EARLIER ( Data[Year] ) && Data[Employee code] = EARLIER ( Data[Employee code] ) ), Data[Relation] ) RETURN SWITCH ( TRUE (), { "Self" } IN _conditiontable && { "Spouse" } IN _conditiontable && { "Children" } IN _conditiontable && { "Parent" } IN _conditiontable, "ESCP", { "Self" } IN _conditiontable && { "Spouse" } IN _conditiontable && { "Children" } IN _conditiontable, "ESC", { "Self" } IN _conditiontable && { "Spouse" } IN _conditiontable, "ES", { "Self" } IN _conditiontable && { "Parent" } IN _conditiontable, "EP", { "Self" } IN _conditiontable, "E", "Check the logic" )
Jihwan_Kim
4 years agoSuper User
Hi,
Please check the below Calculated Column DAX formula and the attached pbix file.
It is for creating a calculated column.
Family definition CC =
VAR _conditiontable =
SUMMARIZE (
FILTER (
Data,
Data[Year] = EARLIER ( Data[Year] )
&& Data[Employee code] = EARLIER ( Data[Employee code] )
),
Data[Relation]
)
RETURN
SWITCH (
TRUE (),
{ "Self" }
IN _conditiontable
&& { "Spouse" }
IN _conditiontable
&& { "Children" }
IN _conditiontable
&& { "Parent" } IN _conditiontable, "ESCP",
{ "Self" }
IN _conditiontable
&& { "Spouse" }
IN _conditiontable
&& { "Children" } IN _conditiontable, "ESC",
{ "Self" }
IN _conditiontable
&& { "Spouse" } IN _conditiontable, "ES",
{ "Self" }
IN _conditiontable
&& { "Parent" } IN _conditiontable, "EP",
{ "Self" } IN _conditiontable, "E",
"Check the logic"
)
- Anonymous4 years agoNot applicable
Hi,
Thanks a lot. This is exactly what I was looking for.
Regards,
Amit Darak