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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Count Function

Hi All

im after some help, i have a table which lists out all current employees and also lists their line reports all data is within the same table, im trying to count for each resource how many line reports they have - see below what im trying to achieve (in red)

 

the first column are all unique whereas they could appear multiple times in the second column throughout the table, i have tried various count functions and cant get it to work, relatively new to power BI, any help is much appreciated

 

 

Current empLine reportNo of line reports
Resource 1Resource20
Resource2Resource23
Resource3Resource20
1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can try this expression in a measure, replacing Table with your actual table name.

 

No. of Line Reports =
VAR thisresource =
MIN ( Table[Current emp] )
RETURN
CALCULATE (
COUNTROWS ( Table ),
ALL ( Table ),
Table[Line Report] = thisresource
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
JonClemo
Regular Visitor

You could achieve the count by using 'group by' on the line report column. This would however effectively remove the other column - so you would be left with Resource and No. of line reports. I guess if you duplicated the table you could then join the grouped table to the original using the resource as the key - this would give you your desired layout . Someone else may have a more elegant solution. 

mahoneypat
Microsoft Employee
Microsoft Employee

You can try this expression in a measure, replacing Table with your actual table name.

 

No. of Line Reports =
VAR thisresource =
MIN ( Table[Current emp] )
RETURN
CALCULATE (
COUNTROWS ( Table ),
ALL ( Table ),
Table[Line Report] = thisresource
)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Worked perfectly Thank you very much!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors