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.
In a table like the one below, I want to replace the values below the word "completed"
Col1 | Col2 | Col3 |
5 | Completed | 9 |
Completed | 10 | 16 |
2 | 5 | Completed |
6 | 8 | 2 |
So the result should be as below:
Col1 | Col2 | Col3 |
5 | Completed | 9 |
Completed | Null | 16 |
Null | Null | Completed |
Null | Null | Null |
Any guide is appreciated. Thanks.
Hi @pouyanebrahimi ,
Try this mcode:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlXSUXLOzy3ISS1JTQGyLZVidaJRRAwNQIQZWNwIyETVARI1A4pYALGRUmwsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Col1 = _t, Col2 = _t, Col3 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Col1", type text}, {"Col2", type text}, {"Col3", type text}}),
ReplaceValues =
List.Transform(
Table.ColumnNames(#"Changed Type"),
each
let
_text = Table.ToList(Table.SelectColumns(#"Changed Type", _)),
_before = List.Range(_text, 0, List.PositionOf(_text, "Completed") + 1),
_after = List.Repeat({null}, List.Count(_text) - List.PositionOf(_text, "Completed") - 1)
in
List.Combine({_before, _after})
),
Table = Table.FromColumns(ReplaceValues)
in
Table
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 |
---|---|
97 | |
97 | |
82 | |
75 | |
66 |
User | Count |
---|---|
126 | |
105 | |
103 | |
81 | |
72 |