Working in Excel 2013 PowerPivot and PowerQuery. In the first sample table below, the '0' needs to be replaced with the Account value in the previous row if the IDs are the same. Something similar to the Excel IF statement, ie. =IF(B2=B1,IF(C2=0,C1,C2),C2) using DAX or M. The second sample table is what I would like.
<tbody>
</tbody>
This is what I would like to see:
<tbody>
</tbody>
Row | ID | Account |
1 | A | 11111 |
2 | A | 0 |
3 | A | 22222 |
4 | A | 0 |
5 | B | 33333 |
6 | B | 0 |
7 | B | 0 |
8 | B | 0 |
9 | B | 0 |
10 | C | 44444 |
11 | C | 44444 |
12 | C | 44444 |
13 | C | 44444 |
14 | C | 44444 |
15 | C | 44444 |
16 | C | 44444 |
17 | C | 44444 |
18 | C | 0 |
19 | D | 55555 |
20 | D | 0 |
21 | D | 0 |
22 | E | 66666 |
23 | E | 66666 |
24 | E | 66666 |
25 | E | 66666 |
26 | E | 66666 |
27 | E | 77777 |
28 | F | 88888 |
29 | F | 0 |
30 | F | 0 |
31 | G | 0 |
32 | G | 99999 |
33 | G | 99999 |
<tbody>
</tbody>
This is what I would like to see:
Row | ID | Account |
1 | A | 11111 |
2 | A | 11111 |
3 | A | 22222 |
4 | A | 22222 |
5 | B | 33333 |
6 | B | 33333 |
7 | B | 33333 |
8 | B | 33333 |
9 | B | 33333 |
10 | C | 44444 |
11 | C | 44444 |
12 | C | 44444 |
13 | C | 44444 |
14 | C | 44444 |
15 | C | 44444 |
16 | C | 44444 |
17 | C | 44444 |
18 | C | 44444 |
19 | D | 55555 |
20 | D | 55555 |
21 | D | 55555 |
22 | E | 66666 |
23 | E | 66666 |
24 | E | 66666 |
25 | E | 66666 |
26 | E | 66666 |
27 | E | 77777 |
28 | F | 88888 |
29 | F | 88888 |
30 | F | 88888 |
31 | G | 0 |
32 | G | 99999 |
33 | G | 99999 |
<tbody>
</tbody>