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 all
I have a table of >1000 rows, with each row looking like this:
Index | Spot 1 | Spot 2 | Spot 3 | Spot 4 | Spot 5 | Spot 6 | Spot 7 | Spot 8 | Spot 9 | Spot 10 | Spot 11 | TICK | NO TICK |
1 | TICK | TICK | TICK | TICK | TICK | TICK | TICK | TICK | TICK | TICK | TICK | 11 | 0 |
2 | NO TICK | NO TICK | NO TICK | NO TICK | NO TICK | NO TICK | NO TICK | NO TICK | NO TICK | NO TICK | NO TICK | 0 | 11 |
Where the last 2 columns add the number of TICK and NO TICK values for each row using this code (for NO TICK):
= Table.AddColumn(#"Replaced Value #2.1", "NO TICK", each List.Count(
List.Select(
Text.Split(
Text.Combine(
List.Transform(Record.ToList(_),each Text.From(_))
,",")
,
","
),each _ ="NO TICK")
))
but what I'd like to do is ignore whatever is in the column Spot 11, so in the example above the figures would be 10 not 11 in the last 2 columns.
What is the easiest way to do this?
Thank you!
Solved! Go to Solution.
@tgjones43 , You can use List.RemoveLastN and remove last element of the list
https://docs.microsoft.com/en-us/powerquery-m/list-removelastn
@tgjones43 , You can use List.RemoveLastN and remove last element of the list
https://docs.microsoft.com/en-us/powerquery-m/list-removelastn
Thanks @amitchandak do you know how to fit that command into the code that I pasted? I can't work this out.
I figured it out, pasting the code below in case it is useful to anyone else:
= Table.AddColumn(#"Replaced Value #2.1", "NO TICK", each List.Count(
List.Select(
Text.Split(
Text.Combine(
List.Transform(List.RemoveLastN(Record.ToList(_),1),each Text.From(_))
,",")
,
","
),each _ ="NO TICK")
))
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 |
---|---|
107 | |
93 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |