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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
kgiboin
Helper I
Helper I

How to pivot data and do a count of occurrences

Hi

If I have a table like this in power query:

Supplier IDRegionSurvey status?
1535GermanyComplete and Up to Date
1563GermanyComplete and Up to Date
2786GermanyComplete and Up to Date
1612FranceComplete but Out of Date
2057GermanyIncomplete
4309GermanyComplete and Up to Date
3717BrazilComplete and Up to Date
1867SpainNot Submitted
4130BrazilComplete and Up to Date
4624ChinaComplete and Up to Date
4068ChinaComplete and Up to Date
3531GermanyComplete and Up to Date
2469GermanyComplete but Out of Date
2666ChinaComplete and Up to Date
4798ChinaComplete and Up to Date
4079GermanyComplete and Up to Date
1734GermanyComplete and Up to Date
4650GermanyComplete and Up to Date
1770FranceComplete but Out of Date
3047GermanyComplete and Up to Date
1605GermanyComplete and Up to Date
2635BrazilComplete and Up to Date
4223SpainComplete and Up to Date
1491BrazilComplete and Up to Date
4412ChinaComplete and Up to Date
2359ChinaComplete and Up to Date
2356GermanyComplete and Up to Date
1373GermanyComplete but Out of Date
4659ChinaComplete and Up to Date
3961ChinaComplete and Up to Date

 

 

How do i get it into this format:

 

Count of Supplier IDColumn Labels   
Row LabelsComplete and Up to DateComplete but Out of DateIncompleteNot SubmittedGrand Total
Germany51 1355
Brazil30 6 36
France63811183
Spain812 11
China28136589384
Grand Total433457813569

 

essentially i want to do a count of the supplier ID's per country for each status they are in. Please help!

1 ACCEPTED SOLUTION
ImkeF
Super User
Super User

Hi @kgiboin ,
if you start the pivot-operation, and select Supplier ID as Values column, click on the advanced options below and change the default-aggregation from Sum to Count.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

1 REPLY 1
ImkeF
Super User
Super User

Hi @kgiboin ,
if you start the pivot-operation, and select Supplier ID as Values column, click on the advanced options below and change the default-aggregation from Sum to Count.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors