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
Anonymous
Not applicable

Create "Employment pause" calculated column

I have a table with employee names, their company their starting date, and if they are employed at a specific date.

I want to create a new column (As displayed in the right-most column below) showing if the employee took a pause from employment and then continued with the same company.

The table has the following format:

EmployeeСompanyStarting dateDateGoes on pause this period 
WilliamAmazon01.01.202001.01.2020No
WilliamAmazon01.01.202001.02.2020Yes
WilliamAmazon01.08.202001.08.2020No
RosaAmazon01.03.202001.03.2020No
RosaeBay01.08.202001.08.2020No

 

Today's month = August (8th month), year = 2020.

 

From the above table, William had taken a break from 01.02.2020 till 01.08.2020 and renewed with the same company on 01.02.2020, so he should have a "Yes" on his last employment month before the break.

Rosa also took a break, but she also changed the company, so that does not count.

As 01.08.2020 is the last known time period, we don't know if the employee will take a break or not, so there is a "No" for this period as well.

Thank you for assistance in advance (:

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Please try the DAX code below.

Column = 
VAR nextStartDate =
    MINX (
        FILTER (
            Employee,
            Employee[Employee] = EARLIER ( Employee[Employee] )
                && Employee[Сompany] = EARLIER ( Employee[Сompany] )
                && Employee[Starting date] >= EARLIER ( Employee[Date] )
        ),
        Employee[Starting date]
    )
RETURN
    IF ( nextStartDate > Employee[Date], "Yes", "No" )

11052.jpg 

Assume that if one doesn't have a break, then the next starting date will equals to the specific date in its previous row.

 

Best Regards,

Community Support Team _ Jing Zhang

If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

Please try the DAX code below.

Column = 
VAR nextStartDate =
    MINX (
        FILTER (
            Employee,
            Employee[Employee] = EARLIER ( Employee[Employee] )
                && Employee[Сompany] = EARLIER ( Employee[Сompany] )
                && Employee[Starting date] >= EARLIER ( Employee[Date] )
        ),
        Employee[Starting date]
    )
RETURN
    IF ( nextStartDate > Employee[Date], "Yes", "No" )

11052.jpg 

Assume that if one doesn't have a break, then the next starting date will equals to the specific date in its previous row.

 

Best Regards,

Community Support Team _ Jing Zhang

If this post helps, please consider Accept it as the solution to help other members find it.

amitchandak
Super User
Super User

@Anonymous , can you provide expected output in table format

Anonymous
Not applicable

@amitchandak , the expected output is the right-most column ("Goes on pause this period"), sorry for the possible confusion

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.