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
strongr
Regular Visitor

How to count occurrences for a Power BI Report Table visual

in Microsoft power bi given a source table of resource names and the projects and task they are assigned to how do I count for each resource name number of task  task they have and but that total value in a summary table column and also count the number of task they have and then put that total count in a separate column in the summary table?

SOURCE TABLE

Resource name

Projects

Task

John

Project A

Task 1A

John

Project B

Task 1B

Sally

Project A

Task 2A

 

SUMMARY TABLE:

Resource name

Number of Projects

Number of Task

John

2

2

Sally

1

1

 

2 ACCEPTED SOLUTIONS
v-xinruzhu-msft
Community Support
Community Support

Hi @strongr 

In power query, you can use group by to achieve this goal.

You can duplicate the table first

vxinruzhumsft_0-1715220805365.png

Then in the new table you can create a new step and input the following code.

 

Table.Group(#"Changed Type", {"Resource name"}, {{"Number of Project", each List.Count(List.Distinct([Projects])), Int64.Type}, {"Number of Tasks", each List.Count(List.Distinct([Task])), Int64.Type}})

 

Output

vxinruzhumsft_0-1715303359600.png

And you can refer to the attachments.

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

KRISHP1234
Helper I
Helper I

You can do by using advance grouping.

KRISHP1234_0-1715252089796.png

  • Advance Grouping

KRISHP1234_1-1715252097825.png

  • Output:
    KRISHP1234_2-1715252293521.png

     

View solution in original post

4 REPLIES 4
strongr
Regular Visitor

Thanks, that worked!!!

strongr
Regular Visitor

Thanks, that worked!!!

KRISHP1234
Helper I
Helper I

You can do by using advance grouping.

KRISHP1234_0-1715252089796.png

  • Advance Grouping

KRISHP1234_1-1715252097825.png

  • Output:
    KRISHP1234_2-1715252293521.png

     

v-xinruzhu-msft
Community Support
Community Support

Hi @strongr 

In power query, you can use group by to achieve this goal.

You can duplicate the table first

vxinruzhumsft_0-1715220805365.png

Then in the new table you can create a new step and input the following code.

 

Table.Group(#"Changed Type", {"Resource name"}, {{"Number of Project", each List.Count(List.Distinct([Projects])), Int64.Type}, {"Number of Tasks", each List.Count(List.Distinct([Task])), Int64.Type}})

 

Output

vxinruzhumsft_0-1715303359600.png

And you can refer to the attachments.

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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