{"id":44057,"date":"2018-11-26t16:56:38","date_gmt":"2018-11-26t21:56:38","guid":{"rendered":"\/\/www.deco-dalles.com\/?p=44057"},"modified":"2019-10-18t14:03:59","modified_gmt":"2019-10-18t18:03:59","slug":"excel-power-query-to-graph-p6-data","status":"publish","type":"post","link":"\/\/www.deco-dalles.com\/excel-power-query-to-graph-p6-data\/","title":{"rendered":"use excel power query to graph p6 data"},"content":{"rendered":"

excel power query & p6 go hand-in-hand. around two years ago, i realized that although my role as a project planner was based on my skills in primavera p6<\/a>, i was spending a significant amount of my day doing repetitive work in excel. i would update my project schedules in p6 and then spend hours getting all the reports ready.<\/p>\n

all this changed when i came across excel\u2019s new data transformation tool power query<\/a>. power query came out as a plug-in for excel 2014 and is now standard in all post 2014 excel products. power query is designed to transform and shape data into a format that can be organized though a pivot table. the reason this technique is so good for primavera p6 users is that primavera p6 is a database system and produces data that is formatted for power query.<\/p>\n

the purpose of this tutorial is to show how the primavera p6 report generating feature along with power query can allow you to quickly and accurately export complex data out of primavera p6<\/a> and create understandable reports for other project members. i have found this feature very valuable in giving the project team a better understanding of the project plan and creating more confidence my role as a project planner.<\/p>\n

this tutorial explains how to use power query for the following scenario: you have been asked to export the resource loading data from p6 into excel to allow a project manager to investigate the resource usage of each work group over time. you are expecting a lot of changes to the schedule and resource curves due to the project deadlines and resource constraints. how do you export the data quickly and accurately to excel every time you get project feedback?<\/em><\/p>\n

before you do this tutorial, please make sure that your version of excel is more recent than 2014 and has a data tab available in the ribbon at the top.<\/strong><\/p>\n

the tutorial is broken into three parts.<\/p>\n

    \n
  1. how to export the resource assignments out of primavera p6 into a csv file using the report generating function.<\/li>\n
  2. how to use power query in excel to format the csv file into a format that can be used in a pivot table \/ pivot chart.<\/li>\n
  3. how to format the data into a report that a project manager can easily understand.<\/li>\n<\/ol>\n

    part one \u2013 exporting a csv file from p6<\/h3>\n

    世界杯2022亚洲比赛时间 has covered many ways to export p6 data to excel<\/a>, but this technique is a bit different. the first step is to set up the report generating option within primavera p6 to generate a csv file that contains the budgeted and budgeted cumulative hours spread over a month interval. this data will be in the same data format that you see when you click the resource assignment<\/a> screen within primavera p6.<\/p>\n

    \"use<\/p>\n

    step 1<\/strong>
    \nadd a new report to the report section of primavera p6.
    \n\"use<\/p>\n

    step 2<\/strong>
    \nusing the report generating wizard, make sure to click the time distribution data<\/strong> check mark, then click the activity resource and role assignments<\/strong> item.
    \n\"use<\/p>\n

    step 3<\/strong>
    \nthe next screen allows you to set the columns, group and sort, and filters that you want applied to the report. for this simple report example, we will only set the columns<\/strong> option. select and add resource name<\/strong> as the only column in the report.
    \n\"use<\/p>\n

    step 4<\/strong>
    \nthe next screen allows you to set the data that you want to see in the time distributed report. click on time interval fields<\/strong> and select cum budgeted units<\/strong> and budgeted units<\/strong>.
    \n\"use<\/p>\n

    step 5<\/strong>
    \non the timescale<\/strong> option, set the date interval<\/strong> to month<\/strong>.
    \n\"use<\/p>\n

    step 6<\/strong>
    \nclick run report<\/strong>. to select the format that the report will be exported in, select the ascii text file<\/strong> option and just use the default options that p6 uses. set the location for the text file that p6 will export under output file<\/strong>.
    \n\"use<\/p>\n

    step 7<\/strong>
    \nclick finish<\/strong>, and you now have a saved report that can be run against any project in primavera p6.<\/p>\n


    \n

    part two \u2013 importing a csv file into excel using power query<\/h3>\n

    the next step is to take the csv file and convert it into a table format that can be analyzed using a pivot table or pivot chart<\/a>. the big advantage to this technique is that in the future, when you export the csv file again, you can simply refresh the excel workbook and the data will be updated.<\/p>\n

    step 1<\/strong>
    \nthe first step is to go to the data<\/strong> tab in excel and click on the get data<\/strong> option.
    \n\"importing<\/p>\n

    step 2<\/strong>
    \nclick from text\/csv<\/strong>. you will have to go to the folder that you exported the csv file into from p6.<\/p>\n

    power query will preview the csv file and parse it into a table format. now open power query and use the interface to shape the data into a format that you can use. click edit<\/strong> in order to do this.
    \n\"importing<\/p>\n

    step 3<\/strong>
    \nthis is the power query interface. the transformations that you will add are listed on the right-hand side of the screen.<\/p>\n

    the first transformation that you want to perform is in column 1. the resource names apply to both the cum budgeted row and the budgeted row. the primavera p6 export, however, skips the second row. you need to correct this and display the resource name in both rows.
    \n\"importing<\/p>\n

    step 4<\/strong>
    \ndepending on your version of excel, power query may handle the data differently. you want the date row to be in the first row of the table so that you can promote them as table headers later on.<\/p>\n

    if your table has the dates in row 1, do nothing and skip to step 5.<\/p>\n

    if row 1 contains empty cells, follow the next step to remove the empty row and position the date rows in the correct place.<\/p>\n

    click on the remove top rows<\/strong> option, enter 1 into the pop-up box and click ok.
    \n\"importing<\/p>\n

    step 5<\/strong>
    \nnow you need to correct the data in column 1. first, you want to remove any spaces around the text in column 1 by using the trim feature. to do this, right click on column 1, go to transform<\/strong> and then click trim<\/strong>.
    \n\"importing<\/p>\n

    step 6<\/strong>
    \nthere is still a problem. you want the blank spaces in column 1 to contain null<\/strong> for the next step. to do this, right click on column 1 and select replace values\u2026<\/strong>
    \n\"importing<\/p>\n

    step 7<\/strong>
    \nin the pop-up box, leave the value to find box blank as that represents the empty spaces. in the replace with<\/strong> box type in null<\/strong> and click ok.<\/p>\n

    the blank cells in column 1 now contain null.
    \n\"importing<\/p>\n

    step 8<\/strong>
    \nnow right click on column 1 and select fill<\/strong> and then down<\/strong>. now the resource names in column 1 are correctly tagged to each row.
    \n\"importing<\/p>\n

    step 9<\/strong>
    \nthe second transformation is to unpivot the time distributed data into two columns; one column to contain the dates and another column to contain the hour data.<\/p>\n

    technically you are normalizing the data. primavera p6 displays the data in a way that is easy for humans to read and understand. you want to undo this step and create a very long table that can be used by the pivot table and pivot chart features in excel. both pivoting and unpivoting data are very useful features in power query.<\/p>\n

    you want to use the data in row 1 as the column headers on the table. double check that the monthly dates for the resource distribution are in row 1. then click the use first row as headers<\/strong> option on the toolbar, as shown below.
    \n\"importing<\/p>\n

    step 10<\/strong>
    \nthe header title on column 2 is not what you want. rename it to units by double clicking on the column header and typing in \u201cunits\u201d.
    \n\"importing<\/p>\n

    step 11<\/strong>
    \nnow for the unpivot step.<\/p>\n

    this is where you take the time distributed columns and rearrange that data into one single column that can be used in a pivot table.<\/p>\n

    you want to unpivot the date columns only \u2013 columns 3, 4, 5, and onward. you want to preserve columns 1 & 2. in the future, you may extend the schedule and add more date columns.<\/p>\n

    to allow the query to work in the future, you select the first two columns by holding shift and selecting them. then, right-click and choose unpivot other columns<\/strong>.<\/p>\n

    this unpivots all the data columns for budgeted units and cumulative units into the format that you need.<\/p>\n

    \"importing<\/p>\n

    step 12<\/strong>
    \nclick on the filter button in the units column. make sure that you only have budgeted and cum budgeted text selected. if you have a null or blank text in this section, uncheck this option as you do not want to include those rows.
    \n\"importing<\/p>\n

    step 13<\/strong>
    \nthe date column has been renamed to \u201cattribute\u201d and the data here is categorized as text.<\/p>\n

    you will want to change this to a date-type field.<\/p>\n

    you also want the date field to show correctly even if you email the file to another country where the end user has a different date format on their computer.<\/p>\n

    to do this, you click on the abc-icon to the left of the column title and click using locale\u2026<\/strong>
    \n\"importing<\/p>\n

    step 14<\/strong>
    \nin the drop-down menu, change data type<\/strong> to date<\/strong> and locale<\/strong> to english (united states)<\/strong>. you will want to use whatever locale is setup on your computer. click ok.
    \n\"importing<\/p>\n

    step 15<\/strong>
    \nnow go to the value<\/strong> column, click on the abc123-icon to the left of the column title and select decimal number<\/strong>.
    \n\"importing<\/p>\n

    step 16<\/strong>
    \nthe final step is to rename columns 3 (attribute) and 4 (value) to be date<\/strong> and hours<\/strong>. you do this by double clicking on the column header and typing the correct text.
    \n\"importing<\/p>\n

    step 17<\/strong>
    \nthe query is now finished. the resource name issue has been fixed and the date and hours data are unpivoted.
    \nnow you want to return the data to your excel worksheet as a table and use the table to create a pivot chart.<\/p>\n

    click close and load to..<\/strong> in the top left corner of the screen.
    \n\"importing<\/p>\n

    you want the data returned as a table in a new tab so select the following options.<\/p>\n

    \"importing<\/p>\n


    \n

    part 3 \u2013 using the data in a pivot chart<\/h3>\n

    you have taken the csv file from primavera p6 and transformed it into a table that can be manipulated by a pivot table or pivot chart.<\/p>\n

    step 1<\/strong>
    \nnow let\u2019s create the pivot table.<\/p>\n

    highlight the entire table, click on the insert<\/strong> tab and select pivot chart<\/strong>. in the option box, click new worksheet<\/strong>.<\/p>\n

    \"using<\/p>\n

    in order to set up the pivot chart, drag the right columns into the appropriate pivot chart fields.<\/p>\n

    drag & drop the date<\/strong> column into the axis<\/strong> categories.<\/p>\n

    drag & drop the units<\/strong> into the legend (series)<\/strong>.<\/p>\n

    drag & drop the hours<\/strong> column into the values<\/strong> section.<\/p>\n

    when you dropped the date<\/strong> column into the axis(categories)<\/strong> section, excel automatically adds years and quarters to the date data. to get the chart to display in months, click on the plus symbol in the bottom right corner of the chart until you see months on the x-axis.<\/p>\n

    the pivot chart now contains the budgeted units and cumulative budgeted units for the project. you need to convert the cumulative budgeted units into a line and assign it a secondary axis.
    \n\"using<\/p>\n

    in order to format the cum budgeted properly, click on the chart and select change chart type<\/strong>.<\/p>\n

    \"using<\/p>\n

    select the combo<\/strong> option on the left side of the change chart type menu. the budgeted series should be a clustered column and be on the primary axis (secondary axis is not selected). the cum budgeted series should be a line and the secondary axis<\/strong> box should be checked. this will display the budgeted units as column with the quantity on the left-hand side and the cum budgeted units as a line with the quantity on the right-hand side.<\/p>\n

    \"using<\/p>\n

    you\u2019re almost done. you want to give the project manager the ability to click on each engineering discipline and see the budgeted units for each discipline over time. this will allow them to review the plan in detail with their team. luckily, as you are working with a pivot chart, this is no big deal. go to the pivotchart fields<\/strong> section and right click on the resource name<\/strong> line and select add as slicer<\/strong>.
    \n\"using<\/p>\n

    the primavera p6 data has been converted into a pivot chart format and the project manager can go through each discipline and review the budgeted units. if there are last-minute changes (there usually are), you simply update primavera p6 and export a new csv file. all the project manager needs to do is refresh and the updated data will be imported and instantly usable.<\/p>\n

    the image below shows how the slicer can be used to select a resource or a group of 世界杯时间比赛时间 . the hours per month and cumulative hours adjust to each selection, giving the project manager<\/a> the ability to dig through the data<\/a>.<\/p>\n

    \"using<\/p>\n

    the final step is to clean up the cumulative budgeted line. when you exported the data from primavera p6 the report included 4 months too much of cumulative data. remove this by clicking on the data<\/strong> tab, selecting queries and connections<\/strong>, opening the query that was just created, and clicking on the drop-down menu at the top of the date column. filter the dates to include dates that are before the 1st of february 2019. then click close and load<\/strong> in the top left corner and the pivot chart will update and display the data correctly. you will have to adjust this filter in the future if the project schedule changes and the 世界杯时间比赛时间 push past the 1st of february.<\/p>\n

    \"using<\/p>\n

    \"using<\/p>\n

    \"using<\/p>\n

    finally, remember that once the query is set up and you update the csv data source, you will have to update the link between power query and the source file. you do this by selecting refresh all<\/strong> in the data<\/strong> tab.<\/p>\n

    \"using<\/p>\n

    i hope that this tutorial gave you a useful introduction to what power query can do. i have found it to be a valuable tool that drastically helps reduce repetitive tasks and i hope that it can help you out too.<\/p>\n

    let us know what you think by leaving a comment below.<\/p>\n

    \"new<\/a><\/span>