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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
kendall
Helper I
Helper I

(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
kendall
Helper I
Helper I

great, that worked out. thanks, kendall

kendall
Helper I
Helper I

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
Super User
Super User

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!

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

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors
Top Kudoed Authors