Forum Discussion
pedanticpad
6 years agoHelper II
Assign Department from Audit Table
Hi, I have employee data from a time management system with clock in and out per day laid out in a table like the below; DATE USERID CLOCK 25/02/2020 1234 08:00:00 25/02/2020 1234 ...
- 6 years ago
Hi, pedanticpad
Based on your data, you may create two calculated columns in 'Clock' table as follows.
COSTCODE = CALCULATE ( MAX ( 'Audit'[NewValue] ), FILTER ( 'Audit', 'Audit'[UserID] = 'Clock'[UserID] && 'Audit'[ChangeType] = "COSTCODE" && 'Audit'[ChangeDate] = CALCULATE ( MAX ( 'Audit'[ChangeDate] ), FILTER ( 'Audit', 'Audit'[ChangeDate] <= 'Clock'[Date] && 'Audit'[UserID] = 'Clock'[UserID] ) ) ) ) DEPARTMENT = CALCULATE ( MAX ( 'Audit'[NewValue] ), FILTER ( 'Audit', 'Audit'[UserID] = 'Clock'[UserID] && 'Audit'[ChangeType] = "DEPARTMENT" && 'Audit'[ChangeDate] = CALCULATE ( MAX ( 'Audit'[ChangeDate] ), FILTER ( 'Audit', 'Audit'[ChangeDate] <= 'Clock'[Date] && 'Audit'[UserID] = 'Clock'[UserID] ) ) ) )Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-alq-msft
6 years agoCommunity Support
Hi, pedanticpad
I wonder the result of the last step before pivotting. Here is my result before pivotting.
If you have null in one column, you can click 'more options', choose what you want to filter.
Best Regards
Allan
pedanticpad
6 years agoHelper II
Hi v-alq-msft ,
See below step before the pivot;
I tried to filter out the null values but I got the below after pivoting;
Error;
Is the issue maybe that I am trying to do this against all employees not just one like in the example I gave?