Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Baskar
Resident Rockstar
Resident Rockstar

Get distinct Employee


Dear Power BI Champions,

Help me on this case, here i have attached the employee table.

Goal :

       How to get the distinct employee in the table. Only using DAX , not in Power Query

My Approach :
     Count Employees = SUBSTITUTE(CONCATENATEX(VALUES(Table1[Employees]),Table1[Employees]),"/",BLANK())

Now am getting the total employee vount like "16".

Please help me to reach my goal. Thanks Advanced.

Employee TableEmployee Table

 

@Greg_Deckler
@Seth_C_Bauer

@MarcelBeug
@Vvelarde
@MattAllington

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Solved it!  Missed a summarize!
EDIT: Added code comments for those that wish to follow along. Its complex!

EmployeeCount = COUNTX(   //This is the row that does the count
 SUMMARIZE(     //This will make the distinct values in our column
  ADDCOLUMNS(    //This creates the calculated column of our Employee Names
   FILTER(    //This cuts down the dummy table to only be the size of the number of Names we have
    CROSSJOIN(  //This Merges our Dummy Table with the Employee Names
     SUMMARIZE( //This creates each 'Employee Name' row
      Table1,
      Table1[Employees],
      Table1[Name],
      "NamesCnt",
      1 + len(Table1[Employees]) - len(SUBSTITUTE(Table1[Employees], "/", "")) //Count of Slashes
     ),
     DummyTbl
    ),
    DummyTbl[Dummy] <= [NamesCnt]
   ),
   "SubName",
   PATHITEM(   // This function splits up the Employee names to be placed in each row
    SUBSTITUTE(Table1[Employees], "/", "|"),
    DummyTbl[Dummy]
   )  
  ),
  [SubName]
 ),
 [SubName]  
)

 

View solution in original post

10 REPLIES 10

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.