Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
BrianVT
Resolver I
Resolver I

Column Function To Evaluate Current Row Against Later Row (Next Period)

The following is sample data and would have rows with several years of monthly pulls of a roster and what Org (think department) every employee is in as of the end of each month.  I want to create a column (shown as "Status Change") that evaluates each row against that same person in the next month to see if their Org changed or if they disappeared completely from the list.  "Re-Alignment" would mean that their Org changes in the next period and "Departed" means it was their last month with the company since they were not on the roster in the next period.  Blanks can be given for everything else.

 

File DateNameOrg Tier 1Status Change
10/31/2018Smith, John4.0 
11/30/2018Smith, John4.0 
12/31/2018Smith, John4.0 
1/31/2019Smith, John4.0 
2/28/2019Smith, John4.0 
3/31/2019Smith, John4.0 
4/30/2019Smith, John4.0 
5/31/2019Smith, John4.0Re-alignment
6/30/2019Smith, John8.0 
7/31/2019Smith, John8.0 
8/31/2019Smith, John8.0 
9/30/2019Smith, John8.0 
10/31/2019Smith, John8.0 
11/30/2019Smith, John8.0Departed

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@BrianVT 

pls try to create a column

Column = 
var org= MINX(FILTER(Sheet1,Sheet1[Name]=EARLIER(Sheet1[Name])&&'Sheet1'[File Date]>EARLIER(Sheet1[File Date])),Sheet1[Org Tier 1])
var _date=MAXX(FILTER(Sheet1,Sheet1[Name]=EARLIER(Sheet1[Name])),Sheet1[File Date])
return if(_date=Sheet1[File Date],"Departed",if(org=Sheet1[Org Tier 1],"","Re-alignment"))

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

@BrianVT 

pls try to create a column

Column = 
var org= MINX(FILTER(Sheet1,Sheet1[Name]=EARLIER(Sheet1[Name])&&'Sheet1'[File Date]>EARLIER(Sheet1[File Date])),Sheet1[Org Tier 1])
var _date=MAXX(FILTER(Sheet1,Sheet1[Name]=EARLIER(Sheet1[Name])),Sheet1[File Date])
return if(_date=Sheet1[File Date],"Departed",if(org=Sheet1[Org Tier 1],"","Re-alignment"))

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks, Ryan - So that column function includes two measures that I need to create first?

@BrianVT 

That's one measure of column.

you can learn more about VAR function here

https://docs.microsoft.com/en-us/dax/var-dax

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Wow, that's amazing.  I've never used thosed within column functions before.  Thank you very much!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.