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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
leonicab
Regular Visitor

Remove vacation day on a table made to show who registered less time than necessary

Hi everyone. I need help on the following.

 

I need help filtering out vacation days from a table I have. Allow me to detail below.

 

My goal is to show a table with the employees' names, the amount of hours they worked on each day and dates. How ever, I want to show only the days that they dind't work according to their daily work time (example: 8 hours a day is the goal but they only worked 7 or less). Therefore I need to leave network days, removing weekends, holidays and vacation days.

 

So I have a main table called fHours, with the following columns: User | Worked Date | Work Hours and many other columns that are not relevant to this problem, plotting only the dates with time register (if the employee didn't register any work on a day, that day doesn't appear on the table)

So I created a fCalender Hours with all the dates from 2023, merging the fHours so I have the days registered + days without any register.

On another table "fHolidays" I can say if that date is a holiday or not. Also, I created another column to sy if it is weekend or not, so that's working just fine. 

Another table "fStatus" ha ve a list of all names and "Yes" or "No" in front of them to check who works 8 or 9 hours/day, so I can say if they have enough time worked/day.

 

NOW THE PROBLEM HERE IS:

The other table fVacations has the columns: Name | Vacation Start Date | Vacation End Date.

I need to say that, if that person was on vacation during the days between start and end date, I should not consider as a required date to work. 

 

For example: this employee was on vacation from date 03/01/2023 to 05/01/2023. I need to filter out the days 03 to 05, but still show day 6 as he needed to work on day 6.

example1.JPG

So the code for that "Vacation" is only connected to the start date. But I need to show "Vacation" from 3 to 5.

 

The code for the measure is currently like the following:

m.Vacation =
IF (
    MIN ( fVacation[Start Date] ) >= MIN ( 'dCalender Hours'[Date] )
        && MIN ( fVacation[Finish Date] ) <= MIN ( 'dCalender Hours'[Date] ),
    "Vacation",
    "Workday"
)
 

Now I'm stuck into thinking how can I solve that problem. I'm not being able to make it work so I can filter all the employees vacation dates, having only start and finish date.

 

Can you guys please help me?

 

Thank you in advance! If you need more information to help building a solution, I'd be glad to provide.

1 REPLY 1
leonicab
Regular Visitor

Help

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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