Forum Discussion

milzha's avatar
milzha
Icon for Microsoft Employee rankMicrosoft Employee
10 years ago
Solved

countrow

I have two table as below. One shows who took what classes, and the other one shows who report to whom. I have troublems adding colum "Total employees report to" into the final view. Should be simply...
  • AlexChen's avatar
    10 years ago

    Hi,

     

    You can create a table using code below to do this.

     

    Table = SUMMARIZE(ReoportTo, ReoportTo[Reoportto],

                                  " Count of employees take Cooking Class", if(COUNTAx(FILTER(Class, Class[Class] = "Cooking"), Class[Class]) = BLANK(), 0, COUNTAx(FILTER(Class, Class[Class] = "Cooking"), Class[Class])),

                                    " Total employees report to", COUNTA(ReoportTo[EmployeeID]),

                                   "percentage", ((if(COUNTAx(FILTER(Class, Class[Class] = "Cooking"), Class[Class]) = BLANK(), 0, COUNTAx(FILTER(Class, Class[Class] = "Cooking"), Class[Class])) / COUNTA(ReoportTo[EmployeeID])) * 100) & "%" )

     

    This is the result:

     

    Best Regards

    Alex