Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I need to count employees that move cost centre by month. I thought a flag in the script would allow me to do a set analysis for this purpose. In the below table, one employee (yellow highlight) has changed cost centres. I thought a concatenation of Cost Centre and EmployeeID and something like EXISTS or PEEK might do it, but I can't figure it out. Is this possible?
Many thanks
Hi @zakpullen
I think the easiest way to do it is using mappings. Take a look on the code below. It returns the Flag as 1 for the Employee that changes the Cost Center and 0 for the ones that didn't (I also put the flag as null for the first month to avoid confusion).
Let me know if it works for you.
Kind Regards
Daniel
Such aggregations like count([Cost Centre]) would be working - but it would always be relating to group by fields and the included periods. If it always goes against a fixed state and/or you may outsource n views of them within an extra table it might be suitable for your scenario.
Another approach could be to use interrecord-functions within an appropriate sorted resident load querying the previous record for the employee and cost centre and comparing it with the current record - enabling you to create a 0/1 flag and/or any running field.
Hi @zakpullen
I think the easiest way to do it is using mappings. Take a look on the code below. It returns the Flag as 1 for the Employee that changes the Cost Center and 0 for the ones that didn't (I also put the flag as null for the first month to avoid confusion).
Let me know if it works for you.
Kind Regards
Daniel
Hi Daniel,
I had to remove Date# from the expression, but it seems to have worked.
Thank you so much.
Hi @zakpullen
Yes, the Date# is set in my code because I'm loading the dates from an Inline. Then, they are considered a string and I need to put the Date# to transform them to a date. However, if your code provides the data already in date format, then it is not needed.
Kind Regards
Daniel