March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hey there, I have a data set where a few of the fields contain concatenated values. The values get that way because form fields will allow the user to select multiple inputs. The field is pipe delimited. How could I go about (1) determining if any given record contains concatenated values in those fields, and (2) count how many possible concatenations are in each given field for a given record?
ID | Title | Concat_1 | Concat_2 | concat_1_concat? | concat_2_concat? | Concat_1_count | Concat_2_count |
1 | a | abc|def|pqr | Item1|Item2|Item3|Item4 | Yes | Yes | 3 | 4 |
2 | b | abc | Item1 | No | No | 1 | 1 |
3 | c | abc|def|pqr|xyz | Item2 | Yes | No | 4 | 1 |
Edit: Figure out part 1. Using the following tells me if a PIPE/concatenated value is present
each if [field_name] = null then 0 else Text.Contains([field_name]), "|") then 1 else 0
Solved! Go to Solution.
Hi @gemcityzach ,
are you looking for something like this?
#"Added Conditional Column" = Table.AddColumn(
#"previous step",
"Concat_1_count",
each Text.Length(Text.Select([Concat1], "|")) + 1,
type number
),
#"Added Conditional Column1" = Table.AddColumn(
#"Added Conditional Column",
"Concat_1_concat?",
each if [Concat_1_count] > 1 then "TRUE" else "FALSE",
type logical
Hi @gemcityzach ,
are you looking for something like this?
#"Added Conditional Column" = Table.AddColumn(
#"previous step",
"Concat_1_count",
each Text.Length(Text.Select([Concat1], "|")) + 1,
type number
),
#"Added Conditional Column1" = Table.AddColumn(
#"Added Conditional Column",
"Concat_1_concat?",
each if [Concat_1_count] > 1 then "TRUE" else "FALSE",
type logical
That's more or less what I ended up doing. For the detect pipes I used a text.contain and then to count pipes I did exactly what you suggest and added +1 to account for the starting index value that is almost always there.
What do you mean by "How many possible concatenations are in each given field for a given record?" What is the expected result from your sample data?
The expected result is in the example. ID 1 shows the count of concatenated values in the different reference fields.
Not sure I understand the List.Max bit. The code you provided appears to give me the count of multiple pipes in the field.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |