Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to return a specific field for a record

Hi, I have connected PowerBI to Microsoft Project Online and have a question on how to return the relevant project and programme manager for a project.

All projects, programmes and portfolios are contained in the projects table. Each row is a project, programme or portfolio. Each row has a 'type' field that identifies which of these the row is. Each row also has a 'manager' field, a 'programme' field that identifies what programme the row belongs to and a  'portfolio' field that identifies what portfolio the row beleongs to. So an example table would be:

PortfolioProgrammeProjectTypeManager
Mars Colonisation PortfolioSpaceship programmeWooden MustardProjectBrent Bell
Mars Colonisation PortfolioSpaceship programmeIron SpanielProjectBrent Bell
Mars Colonisation PortfolioSpaceship programmeSpaceship programmeProgrammeDarren Marsh
Mars Colonisation PortfolioNOT PART OF A PROGRAMMEMars Colonisation ortfolioPortfolioJulius Floyd
Mars Colonisation PortfolioEstablish base programmeGray TitaniumProject

Jobe Ray

Mars Colonisation PortfolioEstablish base programmePlatinum BeagleProjectJobe Ray
Mars Colonisation PortfolioEstablish base programmeEstablish base programmeProgramme

Lorenzo Colley

 

I wish to return the relevant programme and portfolio manager for each record, as follows. How would i do this?

Unfortunately I cannot separate the projects, programmes and portfolios into separate tables as the data strcuture is managed by Microsoft Project Online...

 

PortfolioProgrammeProjectTypeManagerPROGRAMME MGRPORTFOLIO MGR
Mars Colonisation PortfolioSpaceship programmeWooden MustardProjectBrent BellDarren MarshJulius Floyd
Mars Colonisation PortfolioSpaceship programmeIron SpanielProjectBrent BellDarren MarshJulius Floyd
Mars Colonisation PortfolioSpaceship programmeSpaceship programmeProgrammeDarren MarshDarren MarshJulius Floyd
Mars Colonisation PortfolioNOT PART OF A PROGRAMMEMars Colonisation ortfolioPortfolioJulius FloydJulius Floyd
Mars Colonisation PortfolioEstablish base programmeGray TitaniumProject

Jobe Ray

Lorenzo Colley

Julius Floyd
Mars Colonisation PortfolioEstablish base programmePlatinum BeagleProjectJobe RayLorenzo ColleyJulius Floyd
Mars Colonisation PortfolioEstablish base programmeEstablish base programmeProgramme

Lorenzo Colley

Lorenzo ColleyJulius Floyd
  • hi  Anonymous 

    Create two column as below:

    PROGRAMME MGR = CALCULATE(MAX('Table'[Manager]),FILTER('Table','Table'[Portfolio]=EARLIER('Table'[Portfolio])&&'Table'[Programme]=EARLIER('Table'[Programme])&&'Table'[Type]="Programme"))
    PORTFOLIO MGR = CALCULATE(MAX('Table'[Manager]),FILTER('Table','Table'[Portfolio]=EARLIER('Table'[Portfolio])&&'Table'[Type]="Portfolio"))

    Result:

     

    and here is sample pbix file, please try it.

     

    Regards,

    Lin

2 Replies

  • Anonymous , 

     

    You can create a conditional column on Power query to do so. 

    #"Added Conditional Column" = Table.AddColumn(#"Changed Type1", "Custom", each if [Type] = "Portfolio" then [Manager] else null),
    #"Renamed Columns" = Table.RenameColumns(#"Added Conditional Column",{{"Custom", "Portfoli MGR"}}),
    #"Added Conditional Column1" = Table.AddColumn(#"Renamed Columns", "Custom", each if [Type] = "Programme" then [Manager] else null),
    #"Renamed Columns1" = Table.RenameColumns(#"Added Conditional Column1",{{"Custom", "Programme MGR"}})

     

     

    If you want to fill the oother rows which are empty, on else part you can mention the Value to be filled. 

     

    Regards, 

    Manikumar

  • v-lili6-msft's avatar
    v-lili6-msft
    Community Support

    hi  Anonymous 

    Create two column as below:

    PROGRAMME MGR = CALCULATE(MAX('Table'[Manager]),FILTER('Table','Table'[Portfolio]=EARLIER('Table'[Portfolio])&&'Table'[Programme]=EARLIER('Table'[Programme])&&'Table'[Type]="Programme"))
    PORTFOLIO MGR = CALCULATE(MAX('Table'[Manager]),FILTER('Table','Table'[Portfolio]=EARLIER('Table'[Portfolio])&&'Table'[Type]="Portfolio"))

    Result:

     

    and here is sample pbix file, please try it.

     

    Regards,

    Lin