Forum Discussion

CH_MJR79's avatar
CH_MJR79
Icon for Helper II rankHelper II
4 years ago

Leave/holiday chart with horizontal bars

Hello all,

 

I'm trying to create a leave/holiday chart with horizontal bars that we can link up with a spreadsheet exported from our HR system.

 

Basically the spreadsheet contains columns for the employee name, holiday start date and holiday end date. There would be multiple rows for each employee to reflect all of the leave they have booked for the year.

 

Here is mock-up of what I would like Power Bi chart to look like:

 

 

Here is an extract of the Excel data:

First NameLast NameHoliday Start DateHoliday End Date
Employee 1 First NameEmployee 1 Last Name16/02/202218/02/2022
Employee 1 First NameEmployee 1 Last Name24/06/202201/07/2022
Employee 1 First NameEmployee 1 Last Name08/07/202218/07/2022
Employee 2 First NameEmployee 2 Last Name19/04/202222/04/2022
Employee 2 First NameEmployee 2 Last Name24/05/202224/05/2022
Employee 2 First NameEmployee 2 Last Name26/05/202226/05/2022
Employee 2 First NameEmployee 2 Last Name02/07/202216/07/2022

 

I'm new to Power Bi so learning as I go along

 

I was wondering if anyone had any ideas on if such a chart would be possible in Power Bi, and if it was how I would go about creating it?

 

Many thanks

5 Replies

  • Syk's avatar
    Syk
    Icon for Resident Rockstar rankResident Rockstar

    It looks like you want some sort of Gantt chart. In the visuals pane, you can bring in more visuals. Select get more visuals and then search for "Gantt". This is probably a good starting point at least..

     

  • What I am looking for is exactly what is detailed on this post: (Link) although unfortunately the op didn't post any details as to how he created it.

     

    I have taken a look at the Gantt chart options but with a Gantt chart each new entry is a task, and each task can only have one start and end date. In my case, each employee will have multiple start and end dates to reflect all of the holiday dates they have booked for the year.

    • Syk's avatar
      Syk
      Icon for Resident Rockstar rankResident Rockstar

      That post is using a table with conditional formatting. Basically showing if the value is "AL", make the background green

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  CH_MJR79 ,

    Here are the steps you can follow:

    1. In Power query. Add Column – Index Column – From 1.

    2. Create calculated column.

    Day =
    DATEDIFF('Table'[Holiday Start Date],'Table'[Holiday End Date],DAY)

    3. Find Gantt Chart by MAQ through Get more visual.

    4. Find Category labels - open Hierarchy layout.

    5. Result:

     

    Best Regards,

    Liu Yang

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

    • CH_MJR79's avatar
      CH_MJR79
      Icon for Helper II rankHelper II

      Thanks, but it seems to be showing everything in terms of months rather than detailing each individual day of the month.

       

      Also, each separate leave date for each employee is on a separate line.