How to countif and remove duplicates with Power Query

phillipc1

New Member
Joined
Oct 11, 2023
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am still new to power query and working on what I think is pretty simple, but I am struggling. Essentially I have a column of values that I want to transform into a table that will tell me how many times that value shows up. Below I have the sample data set as well as what I would like to see come out after using power query.

Weekly Overdue for Check-in.xlsx
F
1Group Name
21234
34321
41234
56478
64321
74321
85843
91546
108315
118315
123516
134321
145843
1546
161685
171234
181546
195843
Sheet1


Weekly Overdue for Check-in.xlsx
KL
1Group NameCount of Groups
212343
343214
464781
558433
615462
783152
835161
9461
1016851
Sheet1
Cell Formulas
RangeFormula
L2:L10L2=COUNTIF($F$2:$F$19,K2)
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"Group Name"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"
 
Upvote 0
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"Group Name"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"

Hi Alansidman,

Thank you for the response. I can see the logic surrounding this, but I realized I am not doing this all within the current workbook. I have another workbook that I am using a "Get Data" call from this workbook and transforming the data I pull in. What change to the formula would I need to make to accommodate this? I assume changing the "Source =" section, however I am unsure how I would write that. I have listed below the data source and target workbook names.

Data Source: "Weekly Overdue for Check-in.xlsx"
Data Target: "Open Items Report"
 
Upvote 0
Just load the data in your current workbook from the other then apply the GroupBy line to the new query. It should still start with the let and Source lines.
 
Upvote 0
Solution

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top