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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Count cells that contain a specific character

Hi,

I'm using this formula in Power Query to create a new column based on the cell values:

= Table.AddColumn(#"Changed Type2", "CompletedActual", each Text.Length(Text.Combine(List.Transform(Record.FieldValues(_),each if _="✔" then "1" else ""))))

This creates a new column with the count of ✔ for each row but I also want to include in this count the cells that contain "!". 

Any help/tip is welcome. If you need more information/clarification tell me.

Thank you,
Ferk

3 REPLIES 3
dufoq3
Super User
Super User

Hi @Anonymous,

dufoq3_0-1706636797643.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("JcixEcAwDELRVYTqbKRzAfJILj1dJgmnNNz7VCX53kPmeiolOYQJC/BMRFgRgcFcVO8flLqB7Vwf", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    Ad_CountSeparetely = Table.AddColumn(Source, "Count Separetely", each "Count ✔ = " & Text.From(List.Count(List.Select(Text.ToList([Column1]), each _ = "✔")))
& ", " &
"Count ! = " & Text.From(List.Count(List.Select(Text.ToList([Column1]), each _ = "!"))), type text),
    Ad_CountTogether = Table.AddColumn(Ad_CountSeparetely, "Count Together", each List.Count(List.Select(Text.ToList([Column1]), each List.Contains({"✔","!"}, _))), Int64.Type)
in
    Ad_CountTogether

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Anonymous
Not applicable

Hi @dufoq3 , thank you for your help. 

Instead of specifying Column1 can you rewrite to iterate all the columns on the table and you can simplify to get only the Count Together?

Thanks,
Ferk

@Anonymous of course 🙂

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("NYsxDoAwCEWvAswdak08ikvtACUm7dp4E0dP50mkJG6P9z45E/P73MwUqDUjKiGTiBgKmkQwAh2we7EDcc4CDT07dLfgIwB08C+2DOiVpaq5OTmuGNP2exapFVFnXdI6dfkA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
    Merged = Table.FromList(Table.ToList(Source, Combiner.CombineTextByDelimiter("")), Splitter.SplitByNothing(), type table [Merged=text]),
    Ad_CountTogether = Table.AddColumn(Merged, "Count ✔ and !", each List.Count(List.Select(Text.ToList([Merged]), each List.Contains({"✔","!"}, _))), Int64.Type)
in
    Ad_CountTogether

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.