cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Edelmundo Frequent Visitor
Frequent Visitor

Checking if record was the same in previous month

Hi All

 

I have a scenario relating to a Staff List, i have a list of staff that will be updated each month with the complete staff list as at that point in time. I categorise this with a DataDate field which in this case will be the 1st day of each month.

 

My scenario is that i want to be able to create either a Calculated column or measure that will tell me if that person transfered into that CostCentre for that month.  For example in the list below when looking at the data date of 1/1/2018 there are 6 staff 3 in cost centre ABC and 3 in DEF.  In the following month data date is 1/2/2018 we can see that there is now only 2 staff in ABC and 4 in DEF, i want to be able to show a flag or value that shows Alan Smith has transfered into cost centre DEF by looking back at the pervious month and seeing that his CostCentre was not equal to DEF but was actually ABC. 

 

I thought i could maybe user FILTER or SEARCH but am struggling to get the correct results.  This is a cutdown version of my staff list in order to simplify this, i have this data loaded in power bi desktop. 

 

StaffTable.PNG

 

 

 

 

Any help or advice is greatly appreciated

 

Thanks

 

Eddie

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Checking if record was the same in previous month

@Edelmundo,

 

You may add a calculated column as shown below.

Flag =
VAR prev =
    LOOKUPVALUE (
        Table1[CostCentre],
        Table1[DataDate], DATE ( YEAR ( Table1[DataDate] ), MONTH ( Table1[DataDate] ) - 1, 1 ),
        Table1[StaffNumber], Table1[StaffNumber]
    )
RETURN
    IF ( ISBLANK ( prev ) || Table1[CostCentre] = prev, 0, 1 )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Checking if record was the same in previous month

@Edelmundo,

 

You may add a calculated column as shown below.

Flag =
VAR prev =
    LOOKUPVALUE (
        Table1[CostCentre],
        Table1[DataDate], DATE ( YEAR ( Table1[DataDate] ), MONTH ( Table1[DataDate] ) - 1, 1 ),
        Table1[StaffNumber], Table1[StaffNumber]
    )
RETURN
    IF ( ISBLANK ( prev ) || Table1[CostCentre] = prev, 0, 1 )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Edelmundo Frequent Visitor
Frequent Visitor

Re: Checking if record was the same in previous month

Excellent that is exactly what i was looking for.

 

Many Thanks 

 

 

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 382 members 3,523 guests
Please welcome our newest community members: