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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

(explanatory screenshot included) Writing DAX code for number of values in column per specific value

Hello,

 

I would like to create an additional column called "Index" that shows the number of surveys per employee. For example, in this screenshot, it looks like employee S-249 has four corresponding Surveys in the "Survey #" Column. What code would I write for an additional column that would show the number of surveys per employee?

Screenshot (19).png

Thanks, Kendall

1 ACCEPTED SOLUTION

Hi,

you have to group only for Emplyee and then the count is going to be on surveys

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

great, that worked out. thanks, kendall

Anonymous
Not applicable

Thanks serpiva. Forgive me as this is a basic question: where would I find the Group By function in the query editor? Thanks. 

Hi,

here it is

serpiva64_1-1676499049778.png

 

 

serpiva64
Solution Sage
Solution Sage

Hi,

you have to Group By; something like this

serpiva64_0-1676412722780.png

then you expand your nested table and in the column Count you have your result (if you need to count for a period of time you have to add another Grouping

If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!

Anonymous
Not applicable

Hi Serpiva, so I am doing this, but when I put this out my Index column keeps coming out as "1". Why is it unable to count the number of surveys per employee? Thanks, Kendall

 

Screenshot (41).pngScreenshot (43).png

Hi,

you have to group only for Emplyee and then the count is going to be on surveys

Anonymous
Not applicable

When I do that, it comes out with only two columns: 

 

Is there anyway I can do this by adding a custom column to this existing Query using the Table.AddColumn function?

Screenshot (45).pngScreenshot (46).pngScreenshot (47).png

Hi,

that's because you have to add All Rows as a new column.

Then you expanded it and you have all of your rows with the total for employee

serpiva64_0-1676566532526.pngserpiva64_1-1676566561674.pngserpiva64_2-1676566588680.png

 

See it in the attached example

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

Top Solution Authors