Forum Discussion

jdormer's avatar
jdormer
Helper I
10 years ago

Engagement Role Report - Calculated Column question

I am having some difficulty creating a measure to display the individuals working on an engagement and their roles. I have the following tables:

 

 

 

The managers table lists Managers for each engagement. The AllocationID indicates the individuals role on the team: Salesperson (1), Project Manager (2), or Architect (3). 

 

 

 

 

 

I'd like to create a report that displays the Salesperson, Project Manager, and Architect for each engagement, as seen below. To do so, I'm trying to create a Salesperson column (or measure?), PM column, and architect column. I've looked at the functions CALCULATE, FILTER, RELATED, and others but I'm having difficulty determining the correct formula to populate these columns with the correct information. 

 

 

Let me know if any additional information would be helpful. 

 

Thanks.

11 Replies

  • Vvelarde's avatar
    Vvelarde
    Community Champion

    hi jdormer

     

    create this measure:

     

    SalesPerson = CALCULATE(VALUES(Users[Name]);FILTER(Managers;Managers[Allocation ID]=1))

     

    Project Manager = CALCULATE(VALUES(Users[Name]);FILTER(Managers;Managers[Allocation ID]=2))

     

    Architect = CALCULATE(VALUES(Users[Name]);FILTER(Managers;Managers[Allocation ID]=3))

     

     

    • jdormer's avatar
      jdormer
      Helper I

      Thanks Vvelarde.

       

      When I create the measures you suggest and then add them to a visual, I get a "Can't display the visual." error message. The detailed message states "Calculation error in measure Managers[Architect]: A table of multiple values was supplied where a single value was expected. 

       

       

      Thoughts?

      • Vvelarde's avatar
        Vvelarde
        Community Champion

        And this happen with the other measures also? or just with Architect?

         

         

         

  • v-sihou-msft's avatar
    v-sihou-msft
    Microsoft Employee

    jdormer

     

    In Power BI Desktop, we don’t have such a visual which can completely show result as you expect. If we use a Matrix, we can set “Engagement Name” as Rows and “Role” as Columns. But the Values always aggregates and only accepts numeric values, which means if we put “User Name” into Values, it will always be converted to “Count of User Name” instead of showing the actual User Name.

     

    You may think that we can create a table report with a Salesperson measure, PM measure, and architect measure. But this is feasible only when there is no duplicate Allocation IDs in each Engagements. We cannot make the measure aggregate multiple Names when there’re duplicate Allocations.

     

     

    We can use an alternate solution by creating a Matrix table as below, which marks the User Name with “1” under each Role. If one role have two or more users, multiple User Names will be marked with “1” under one Role.

    Regards,

    • jdormer's avatar
      jdormer
      Helper I

      v-sihou-msft and Vvelarde

       

      Thank you both for taking the time to respond. This was a "want" of one of my managers, not a critical need. If I revisit this and come up with a solution I will post back. 

       

      Thanks,

      • v-sihou-msft's avatar
        v-sihou-msft
        Microsoft Employee

        jdormer

         

        I’ve worked out this problem now. We can use CONCATENATEX function to concatenates multiple names in different rows. Please refer to following steps.

        The relationship between three tables is like below.

         

        1. Create a calculated column in Managers Table which stores the user names.
          NameColumn =
          RELATED ( Users[Name] )
          
        2. Create a measure which count rows for each engagement.
          EngagementRows = 
          CALCULATE (
              COUNTROWS ( 'Managers Table' ),
              ALLEXCEPT ( 'Managers Table', 'Managers Table'[EngagementID] )
          )
          
        3. Create a measure for sales names in each Engagement.
          Sales = 
          CALCULATE (
              CONCATENATEX ( 'Managers Table', 'Managers Table'[NameColumn], ", " ),
              FILTER (
                  'Managers Table',
                  'Managers Table'[Allocation ID] = 1
                      && 'Managers Table'[ID] <= MAX ( 'Managers Table'[ID] )
                      && 'Managers Table'[ID]
                          > MAX ( 'Managers Table'[ID] ) - [EngagementRows]
              )
          )
          
        4. Create a measure for managers names in each Engagement.
          Manager = 
          CALCULATE (
              CONCATENATEX ( 'Managers Table', 'Managers Table'[NameColumn], ", " ),
              FILTER (
                  'Managers Table',
                  'Managers Table'[Allocation ID] = 2
                      && 'Managers Table'[ID] <= MAX ( 'Managers Table'[ID] )
                      && 'Managers Table'[ID]
                          > MAX ( 'Managers Table'[ID] ) - [EngagementRows]
              )
          )
          
        5. Create a measure for architects names in each Engagement.
          Architect = 
          CALCULATE (
                  CONCATENATEX ( 'Managers Table', 'Managers Table'[NameColumn], ", " ),
                  FILTER (
                      'Managers Table',
                      'Managers Table'[Allocation ID] = 3
                          && 'Managers Table'[ID] <= MAX ( 'Managers Table'[ID] )
                          && 'Managers Table'[ID]
                              > MAX ( 'Managers Table'[ID] ) - [EngagementRows]
                  )
          )
          
        6. Drag Table chart into your canvas and select values as below. Set Totals to “Off” in Table Format –> General.