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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Count values of a column

i have a sample data:Please help i really need this

YearMonthname0Count of name0
2021Mayabc1
2021Mayghi2
2021Maysodoko1
2021MayAMAZON LTD1
2021MayMARKS AND SPENCER P.L.C.1
2021Maylakme1
2021JUNEPANTALOON6
2021AUGYOUTH1

THE OUT PUT I WANT ; it will eliminate those companies whose count is more than 1.P:S we cant include name in the final table

YearMonthCount of name0
2021May5
2021Aug1
1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

In Power Query, select your [Count of name] column, select the dropdown at the top of the column, then select 'Number Filters' > 'Equals...' > Enter 1.

Thn multi-select (Ctrl+Click) your [Year] and [Month] columns, go to the Home tab > Group By, and leave the aggregation column as Count Rows.

 

Power Query example code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMlTSUfJNrASSiUnJQNJQKVYHTSI9IxNIGmFKFOen5GfnY9fk6OsY5e+n4BPigl3e1zHIO1jB0c9FITjA1c/ZNUghQM9Hz1kPu+qcxOzcVHQpr1A/VyAV4OgX4ujj7+8HZJshyzuGugPJSP/QEA+I1lgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Year = _t, Month = _t, name0 = _t, #"Count of name0" = _t]),
    chgTypes = Table.TransformColumnTypes(Source,{{"Year", Int64.Type}, {"Month", type text}, {"name0", type text}, {"Count of name0", Int64.Type}}),
    filterOne = Table.SelectRows(chgTypes, each [Count of name0] = 1),
    groupRows = Table.Group(filterOne, {"Year", "Month"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    groupRows

 

Example output:

BA_Pete_0-1664367392158.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

1 REPLY 1
BA_Pete
Super User
Super User

Hi @Anonymous ,

 

In Power Query, select your [Count of name] column, select the dropdown at the top of the column, then select 'Number Filters' > 'Equals...' > Enter 1.

Thn multi-select (Ctrl+Click) your [Year] and [Month] columns, go to the Home tab > Group By, and leave the aggregation column as Count Rows.

 

Power Query example code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMlTSUfJNrASSiUnJQNJQKVYHTSI9IxNIGmFKFOen5GfnY9fk6OsY5e+n4BPigl3e1zHIO1jB0c9FITjA1c/ZNUghQM9Hz1kPu+qcxOzcVHQpr1A/VyAV4OgX4ujj7+8HZJshyzuGugPJSP/QEA+I1lgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Year = _t, Month = _t, name0 = _t, #"Count of name0" = _t]),
    chgTypes = Table.TransformColumnTypes(Source,{{"Year", Int64.Type}, {"Month", type text}, {"name0", type text}, {"Count of name0", Int64.Type}}),
    filterOne = Table.SelectRows(chgTypes, each [Count of name0] = 1),
    groupRows = Table.Group(filterOne, {"Year", "Month"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    groupRows

 

Example output:

BA_Pete_0-1664367392158.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors