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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Power Query Editor Count of Unique Column Values Into Two Columns

I have two columns in a Table as seen below.

Store NumberAudit Violation
8297Failed Audit
8297Passed Audit
8297Failed Audit
8297Passed Audit
8297Passed Audit
8291Failed Audit
8291Passed Audit
8291Passed Audit
8281Passed Audit
8267Failed Audit
8267Passed Audit

 

I need to basically get a count of each unqieu value and put them into two separate columns like below. How can I do this in Power Query Editor?

Store NumberCount Failed AuditsCount Passed Audits
829723
829112
828101
826711
1 ACCEPTED SOLUTION
Payeras_BI
Solution Sage
Solution Sage

Hi @Anonymous ,

In case you still want to do it in PQ Editor.

Payeras_BI_0-1626790902367.png

= Table.Group(#"Changed Type", {"Store Number"},
{{"Count Failed Audits", each Table.RowCount(Table.SelectRows(_, each ([Audit Violation] = "Failed Audit"))), Int64.Type},
{"Count Passed Audits", each Table.RowCount(Table.SelectRows(_, each ([Audit Violation] = "Passed Audit"))), Int64.Type}})



If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

View solution in original post

2 REPLIES 2
Payeras_BI
Solution Sage
Solution Sage

Hi @Anonymous ,

In case you still want to do it in PQ Editor.

Payeras_BI_0-1626790902367.png

= Table.Group(#"Changed Type", {"Store Number"},
{{"Count Failed Audits", each Table.RowCount(Table.SelectRows(_, each ([Audit Violation] = "Failed Audit"))), Int64.Type},
{"Count Passed Audits", each Table.RowCount(Table.SelectRows(_, each ([Audit Violation] = "Passed Audit"))), Int64.Type}})



If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain
amitchandak
Super User
Super User

@Anonymous , to me this seems like unpivot with count.

First, create a combined column

 

Audit Violation = [Audit] & " " & [Violation]

 

using this column unpivot and take count

 

https://radacad.com/pivot-and-unpivot-with-power-bi

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.