Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have a text column that contains values like -
Text Column
1,2,3,4,5
6,7
1,5,6
For above I would like to return -
5
2
3
Is there a way I can do a count of the numbers? Every number is always seperated by a comma.
Solved! Go to Solution.
Hi @Qotsa
create a calculated column
Column =
PATHLENGTH(
SUBSTITUTE([Text Column];",";"|")
)
do not hesitate to give a kudo to useful posts and mark solutions as solution
By the way, you might use STRING_SPLIT in Transact-SQL if necessary.
SELECT [Column1]
, (
SELECT COUNT(1)
FROM STRING_SPLIT([Column1], ',')
) AS [Count]
FROM [Table1]
Hi,
Taking a cue from the solution shared by hocine satour to a similar problem on my Blog article here, this M code works
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Text", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Count", each List.Count(List.ReplaceValue(Text.Split([Text], ","), " ", "", Replacer.ReplaceText)))
in
#"Added Custom"
Hope this helps.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |