Forum Discussion
Comparing 2 month data for employee movements
- 7 years ago
Hi adhumal2 ,
At first, you need to add a column on each table.
Then append these two tables to get a new table. Add an index column and create a new column "countrows".
countrows = COUNTROWS ( FILTER ( Append1, Append1[EName] = EARLIER ( Append1[EName] ) && Append1[OUnit] = EARLIER ( Append1[OUnit] ) && Append1[FTE] = EARLIER ( Append1[FTE] ) ) )Create a new table.
Table = CALCULATETABLE ( Append1, Append1[countrows] = 1 )
Create three calculated columns:
rank = RANKX ( FILTER ( 'Table', 'Table'[EName] = EARLIER ( 'Table'[EName] ) ), 'Table'[Index], , ASC, DENSE )FTE(Full Time) = VAR A = CALCULATE ( FIRSTNONBLANK ( 'Table'[FTE], 1 ), FILTER ( 'Table', 'Table'[rank] = EARLIER ( 'Table'[rank] ) + 1 && 'Table'[EName] = EARLIER ( 'Table'[EName] ) && 'Table'[EID] = EARLIER ( 'Table'[EID] ) ) ) VAR c = COUNTROWS ( FILTER ( 'Table', 'Table'[EName] = EARLIER ( 'Table'[EName] ) && 'Table'[OUnit] = EARLIER ( 'Table'[OUnit] ) ) ) RETURN IF ( c = 1 && 'Table'[Month] = "P", - 'Table'[FTE], IF ( c = 1 && 'Table'[Month] = "C", 'Table'[FTE], IF ( 'Table'[rank] = 1 && c = 2, 'Table'[FTE] - A ) ) )Remark = VAR c = COUNTROWS ( FILTER ( 'Table', 'Table'[EName] = EARLIER ( 'Table'[EName] ) ) ) RETURN IF ( c = 1 && 'Table'[FTE(Full Time)] > 0, "Entry", IF ( c = 1 && 'Table'[FTE(Full Time)] < 0, "Exit", IF ( c = 2 && 'Table'[FTE(Full Time)] < 0, "Transfer Out", IF ( c = 2 && 'Table'[FTE(Full Time)] > 0, "Transfer In" ) ) ) )Now you can use these fileds to get your visual.
Best Regards,
Eads
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi adhumal2 ,
At first, you need to add a column on each table.
Then append these two tables to get a new table. Add an index column and create a new column "countrows".
countrows =
COUNTROWS (
FILTER (
Append1,
Append1[EName] = EARLIER ( Append1[EName] )
&& Append1[OUnit] = EARLIER ( Append1[OUnit] )
&& Append1[FTE] = EARLIER ( Append1[FTE] )
)
)
Create a new table.
Table = CALCULATETABLE ( Append1, Append1[countrows] = 1 )
Create three calculated columns:
rank =
RANKX (
FILTER ( 'Table', 'Table'[EName] = EARLIER ( 'Table'[EName] ) ),
'Table'[Index],
,
ASC,
DENSE
)
FTE(Full Time) =
VAR A =
CALCULATE (
FIRSTNONBLANK ( 'Table'[FTE], 1 ),
FILTER (
'Table',
'Table'[rank]
= EARLIER ( 'Table'[rank] ) + 1
&& 'Table'[EName] = EARLIER ( 'Table'[EName] )
&& 'Table'[EID] = EARLIER ( 'Table'[EID] )
)
)
VAR c =
COUNTROWS (
FILTER (
'Table',
'Table'[EName] = EARLIER ( 'Table'[EName] )
&& 'Table'[OUnit] = EARLIER ( 'Table'[OUnit] )
)
)
RETURN
IF (
c = 1
&& 'Table'[Month] = "P",
- 'Table'[FTE],
IF (
c = 1
&& 'Table'[Month] = "C",
'Table'[FTE],
IF ( 'Table'[rank] = 1 && c = 2, 'Table'[FTE] - A )
)
)
Remark =
VAR c =
COUNTROWS ( FILTER ( 'Table', 'Table'[EName] = EARLIER ( 'Table'[EName] ) ) )
RETURN
IF (
c = 1
&& 'Table'[FTE(Full Time)] > 0,
"Entry",
IF (
c = 1
&& 'Table'[FTE(Full Time)] < 0,
"Exit",
IF (
c = 2
&& 'Table'[FTE(Full Time)] < 0,
"Transfer Out",
IF ( c = 2 && 'Table'[FTE(Full Time)] > 0, "Transfer In" )
)
)
)
Now you can use these fileds to get your visual.
Best Regards,
Eads
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- adhumal27 years ago
Helper III
v-eachen-msft Thanks a lot. I will try this solution on my data and confirm the output soon. Many Thanks already.
- v-eachen-msft7 years ago
Community Support
Hi adhumal2 ,
If my answer is useful, please accept my reply.Thanks!
Best Regards,
Eads
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- adhumal26 years ago
Helper III
Hi,
I tried the solution on my file and have below observations
- If employee is on 2 positions (with FTE values 0.5 and 0.5), and if one of the position gets reduced by 0.25, still there will be 2 positions (0.5 and 0.25) , in this case the reduced position should be shown as transfer out with 0.25 FTE (only FTE value for 1 position has changed, both position IDs remain same)
- In some cases, though the FTE value has decreased, the FTE column in the 'Table' shows positive FTE value and hence the remark as ' Transfer In'
will you be really kind to help me on this topic?
- adhumal27 years ago
Helper III
Thanks a lot.