Forum Discussion

jchapmanICT's avatar
jchapmanICT
New Member
3 years ago
Solved

Using PowerBI with Project for the Web - Reporting on Summary Tasks and associated SubTask progress

Hi All:

 

Hoping someone can help guide me as a relative noob to both Project for the Web and PowerBI.

 

I need to be able to report on progress on completion of subtasks for each Summary Task in my project.

 

In essence the project plan is setup as follows:

 

Site 1

SubTask 1

SubTask 2

Site 2

SubTask 1

SubTask 2

etc etc...

 

In the PowerBI template for Project for the Web, there doesn't appear to be any way to visualise this. Can anyone help please? Treat me as a complete noob! 🙂

 

Thank you

 

J

  • Hey Amit,

    Thanks for the response. I have now realised that the tables and fields pulled in by the PowerBI template for Project on the Web are not complete. Pulling in the full dataset allows me to use a parent task field which effectively gives me a workaround for this. 

     

    Thanks again

     

    J

18 Replies

  • Hey Amit,

    Thanks for the response. I have now realised that the tables and fields pulled in by the PowerBI template for Project on the Web are not complete. Pulling in the full dataset allows me to use a parent task field which effectively gives me a workaround for this. 

     

    Thanks again

     

    J

    • Nozama's avatar
      Nozama
      Helper I

      How do you mean "pull in all data" - please can you elaborate? I am having the same problem. Thanks.

      • jchapmanICT's avatar
        jchapmanICT
        New Member

        Hi Nozama,

        The default PowerBI template does not include all database tables. Changing this and adding in all tables (initially and while you're building your dashboards) allows you to access all of the fields used in Project for the Web.

         

        Does that help? Happy to try to elaborate if you need me to.

         

        J

  • MelanieEB's avatar
    MelanieEB
    Frequent Visitor

    In cooperation with ChatGPT I was able to develop a funktion that uses the parent tasks to build up a hierarchy. In case anyone is interested in the code, pls. let me know. 

    • Nozama's avatar
      Nozama
      Helper I

      I would be interested. Please can you post it here and let us know how to use it?

      • MelanieEB's avatar
        MelanieEB
        Frequent Visitor

        Dear Nozama,

        I hope the following is clear, if you have any questions, please let me know. 

        Create a new Table (I called it Project Tasks Hierarchy) linked to Project Tasks Staging (Dataverse Table) with the following code 

        let
        Quelle = #"Project Tasks Staging",
        AddHierarchyColumn = Table.AddColumn(Quelle, "Hierarchy", each GetHierarchy([msdyn_projecttaskid])),
        #"Changed type" = Table.TransformColumnTypes(AddHierarchyColumn,{{"Hierarchy", type text}}),
        AddParentTaskCount = Table.AddColumn(#"Geänderter Typ", "ParentTaskCount", each CountParentTasks([Hierarchie]))
        in
        AddParentTaskCount

        To avaoid circular references, go back to Project Tasks Staging and create another linked Table called "Hierarchy Data" with this code. You need to make sure that the ParentTask ID column has no null values, therefore it adds a column called ParentTaskID that makes sure that values coming from msdyn_parenttask are no instead of null, otherwise the functions are not working:

        let
        Quelle = #"Project Tasks Staging",
        #"AddColumn" = Table.AddColumn(Quelle, "ParentTaskID", each if([msdyn_parenttask])= null then "no" else [msdyn_parenttask])

        in
        #"AddColumn"

        Right click on the Table "Project Tasks Hierarchy" and add a Function... called "GetHierarchyRecursive" with the following code:

        let
        GetHierarchyRecursive = (currentTaskID as text, hierarchyList as list) as text =>
        let
        currentTaskRecord = Table.SelectRows(HierarchyData, each [msdyn_projecttaskid] = currentTaskID){0},
        parentTaskID = currentTaskRecord[ParentTaskID],
        projectID = currentTaskRecord[msdyn_project],
        hierarchyItem =
        if parentTaskID <> "no" then
        GetHierarchyRecursive(parentTaskID, hierarchyList & {currentTaskID})
        else
        projectID & "," & Text.Combine(List.Reverse(hierarchyList & {currentTaskID}), ",")
        in
        hierarchyItem
        in
        GetHierarchyRecursive

        Right click on the table "Project Tasks Hierarchy" again and add another function called Get Hierarchy with the following code:

        let
        GetHierarchy = (currentTaskID as text) as text =>
        let
        hierarchie = GetHierarchyRecursive(currentTaskID, {})
        in
        hierarchie
        in
        GetHierarchy

        In order to be able to highlight the different task levels in a Power BI Table visual, I added another function called CountParentTask. This counts how many parent tasks were found for this task and by using the numbers, you can use the conditional formatting of the table visual to improve readablity of the table and make clear which task belongs to which parenttask

        let
        GetParentTaskCount = (hierarchyString as text) as number =>
        let
        commaCount = List.Count(Text.Split(hierarchyString, ",")),
        parentTaskCount = commaCount
        in
        parentTaskCount
        in
        GetParentTaskCount

        As you are connected to Dataverse, the column names of the table Project Tasks Staging should be the same, but please check all the table and column names to make sure the codes are working for you. 

  • MelanieEB's avatar
    MelanieEB
    Frequent Visitor

    After struggling with this for months, I finally found a very easy solution to sort the Project Tasks in the Power Query table for Power BI according the hierarchy they show in the original projects for the web project plan. 

    The msdyn_projecttask table from Dataverse does have a column called msdyn_displaysequence. You need to add a column first, that fills the msdyn_displaysequence values with leading zeros so that they all have the same format. Then add a new column that combines the texts from msdyn_project (which is the project id) and the formattet msdyn_displaysequence column. 

    When you sort this column from A-Z all tasks will be shown in the same order as they appear in the project plan. 

    Code:

    let
    Source = msdyn_projecttask,
    AddDisplaySequenceAsText = Table.AddColumn(Source, "DisplaySequenceText", each Text.From([msdyn_displaysequence])),
    ModifyDisplaySecquence = Table.AddColumn(AddDisplaySequenceAsText, "DisplaySequence", each
    let

    parts = Text.Split([DisplaySequenceText], ","),

    beforeComma = List.First(parts),
    afterComma = if List.Count(parts) > 1 then List.Last(parts) else "",

    formattedBeforeComma = Text.PadStart(beforeComma, 5, "0"),

    formattedValue = formattedBeforeComma & "," & afterComma
    in
    formattedValue
    ),
    AddHierarchy = Table.AddColumn(ModifyDisplaySecquence, "Hierarchy", each Text.Combine({[msdyn_project], Text.From([DisplaySequence])}, ","))

    in
    AddHierarchy