Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello!
I have a column is a text, like aa,bb,aa,aa,aa,cc,aa,aa,.. I need to count how many times aa has appeared in this text.
table is like this
ID Action
001 aa,bb,aa,aa,aa,cc,aa,aa
002 bb,cc,aa,aa,aa,cc,aa,aa,aa,aa,aa
003 aa,dd,dd,aa,aa,aa
I need to add a column to show how many times aa appeared in action for each id.
Thank you in advance for your kind help!
Solved! Go to Solution.
Hi DuoHappy,
Try creating a new calculated column with the following DAX:
Just be careful of case sensitivity.
Good luck, reach out if you need more help!
@Anonymous
You can try a new custom column in the example below by using Power Query
Count M Code for custom column (Text.Length([#"Action"])-Text.Length(Text.Replace([#"Action"],"aa","")))/2
Hi @MDodds , Thank you very much! It is a very smart way! As I am looking for aa instead of a, I think the formula should be : NumberofAAs = (LEN('Table'[Action])-LEN(SUBSTITUTE('Table'[Action],"aa","")))/2, right?
Spot on, good result.
Hi DuoHappy,
Try creating a new calculated column with the following DAX:
Just be careful of case sensitivity.
Good luck, reach out if you need more help!
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
108 | |
101 | |
39 | |
35 |
User | Count |
---|---|
149 | |
122 | |
76 | |
74 | |
52 |