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.
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 emp | Line report | No of line reports |
Resource 1 | Resource2 | 0 |
Resource2 | Resource2 | 3 |
Resource3 | Resource2 | 0 |
Solved! Go to Solution.
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
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.
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Worked perfectly Thank you very much!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.