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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.