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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Kabeerkhan007
Frequent Visitor

Calculate total number of employee in visual by employee id or name.

hey,

I am trying  to calculate total number of employees in the last of row in visual what steps should i follow? Please help me to get rid of this.

Screenshot (153).png 

1 ACCEPTED SOLUTION
tamerj1
Community Champion
Community Champion

Hi @Kabeerkhan007 
You can add the Employee Name Column as a measure:

Employee Name Measure =
IF (
    HASONEVALUE ( TableName[EmpID0 ), SELECTEDVALUE ( TableName[Employee Name] ),
    COUNTROWS ( TableName )
)

View solution in original post

15 REPLIES 15
Anonymous
Not applicable

how many tables do you have. please check the relationships if you are connecting 2 tables. 

tamerj1
Community Champion
Community Champion

@Kabeerkhan007 

Incase you have duplicate ID's in the table you csn use the following measure instead of the column [Employee Name] and you shall get the nimber of employees at the bottom as requested 

Employee Name Measure =
IF (
    HASONEVALUE ( TableName[EmpID] ), SELECTEDVALUE ( TableName[Employee Name] ),
    DISTINCTCOUNT ( TableName[EmpID] )
)

@tamerj1 Still has the same visual. There is no duplicity for the count, I don't want that column to be seen in the table, but I only want the total count.

@Kabeerkhan007 

I totally understand your requirement right from the beginning. The measure I proposed should return the name in all row except in the total where you should  see the total count. I see no reason it shouldn't work!  Would please help me out with a screenshot?

tamerj1
Community Champion
Community Champion

Hi @Kabeerkhan007 
You can add the Employee Name Column as a measure:

Employee Name Measure =
IF (
    HASONEVALUE ( TableName[EmpID0 ), SELECTEDVALUE ( TableName[Employee Name] ),
    COUNTROWS ( TableName )
)
Anonymous
Not applicable

You have 2 options,

1. You can simply drag and drop EmpID in a card visual value field, and change summarization to Count

 

MajeedKhan_0-1655964642424.png

 

 

 

2. OR you can make a new measure :

EmpIDCount = COUNT(Test[EmpID])
 

MajeedKhan_0-1655964368459.png

 

 

@Anonymous Hey thanks for the suggestion. I already have card visual in my main page, I was trying to show in another visual with the help of emp id or name.

I tried your 2 option but its look like this total value is correct but in every column it is showing 1.Screenshot (154).png

Hi @Kabeerkhan007 

did you try my solution?

@tamerj1  Yes, i tried but it's visual are same as @Anonymous  said. It is showing 1 in all column, Which i don't want in my table.

@Kabeerkhan007 

The must be something wrong. Would you please share a screenshot of the code along with the result?

@tamerj1  I just want total number of employee in the last row of table without creating any other column. Is there any method to do with emp id or emp name? Screenshot (155).pngScreenshot (156).png

@Kabeerkhan007 

The closing bracket of HASONEVALUE is missing. Please fix it snd try it in your table. Then you can take the Employee Name column out of the table. 

Screenshot (157).png

Thankyou so much, Now it works absolute perfect..

PC2790
Community Champion
Community Champion

Hey @Kabeerkhan007 ,

 

You have two options here, either have a column with datatype as whole number that can be summed to show the total or have a separate measure like Countofemployees = Count(EmpID) and show it in a card viusal separately.

@PC2790 Hey thanks for the help 

Datatype is already in the whole number and I tried your second option it work and showed me the correct value but it is showing 1 in all rows.Screenshot (154).png

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.