Forum Discussion
Delete rows for some columns to align the data
- 1 year ago
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("nc9BCsMgFEXRvTh28t9bQdroJiQ7CJ11/613GD4BM7mCPNAzRomt1BKvfz7f88yPo47LdbxjdqeN9kh3Ykcb7Up3Zkcb7U5293/UtGjVIizCIixKLcIiLMKi1CIswiIsemDxtHjVYizGYixOLcZiLMbi1HLz9vED", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Column A" = _t, #"Column B" = _t, #"Column C" = _t, #"Column D" = _t, #"Column E" = _t, #"Column F" = _t]), #"Replaced Value" = Table.ReplaceValue(Source,"null",null,Replacer.ReplaceValue,{"Column A","Column B","Column C","Column D","Column E","Column F"}), #"Filled Down" = Table.FillDown(#"Replaced Value",{"Column A", "Column B"}), #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Column C] <> null)) in #"Filtered Rows"How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the entire Source step with your own source.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("nc9BCsMgFEXRvTh28t9bQdroJiQ7CJ11/613GD4BM7mCPNAzRomt1BKvfz7f88yPo47LdbxjdqeN9kh3Ykcb7Up3Zkcb7U5293/UtGjVIizCIixKLcIiLMKi1CIswiIsemDxtHjVYizGYixOLcZiLMbi1HLz9vED", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Column A" = _t, #"Column B" = _t, #"Column C" = _t, #"Column D" = _t, #"Column E" = _t, #"Column F" = _t]),
#"Replaced Value" = Table.ReplaceValue(Source,"null",null,Replacer.ReplaceValue,{"Column A","Column B","Column C","Column D","Column E","Column F"}),
#"Filled Down" = Table.FillDown(#"Replaced Value",{"Column A", "Column B"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([Column C] <> null))
in
#"Filtered Rows"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the entire Source step with your own source.
Thanks.
I'm sorry but I didn't think about the column types with the sample data.
I noticed in the code that there is a column type as text. Would this change something? I tried it with the sample data and it works, but not with the different column types.
This is more how it would look.
| Account Number (number) | Account Description (text) | Date (Date) | Description (Text) | N°ÉJ (Text) | Montant (Dollar) |
| 5574 | 1B | null | null | null | null |
| null | null | 2024-01-02 | Description 1 | 1E1 | 10,00 $ |
| null | null | 2024-01-06 | Description 2 | 1E2 | 263,00 $ |
| null | null | 2024-09-08 | Description 3 | 1E3 | 235,67 $ |
| null | null | null | null | null | null |
| 5578 | 2B | null | null | null | null |
| null | null | 2024-10-03 | Description 4 | 2E1 | 345,68 $ |
| null | null | 2024-11-07 | Description 5 | 2E2 | 234.65 |
| null | null | null | null | null | null |
| 5698 | 3B | null | null | null | null |
| null | null | 2024-02-05 | Description 6 | 3E1 | 34 554,55 $ |
| null | null | 2024-03-07 | Description 7 | 3E2 | 453,00 $ |
| null | null | null | null | null | null |
| 5679 | 4B | null | null | null | null |
| null | null | 2024-01-07 | Description 8 | 4E1 | 6 624,40 $ |
| null | null | 2024-02-26 | Description 9 | 4E2 | 8 456,30 $ |
| null | null | 2024-11-15 | Description 10 | 4E3 | 56 798,00 $ |
- lbendlin1 year ago
Super User
Not really - the process is the same. Fill down the first two columns. Then filter out the nulls in the third column.
- JoelDucharme1 year ago
Helper I
I think it worked! Thank you very much! I really have to take the time to learn Dax better.