Forum Discussion
gwaczoka
3 years agoRegular Visitor
New column with value from previous (last) date
Hi guys, can someone please help me with this issue: I would like to have in another column product flag from previous date (not DAY-1, but last previous) I've found a solution for simil...
Anonymous
3 years agoNot applicable
Hi gwaczoka,
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
gwaczoka
3 years agoRegular Visitor
Hi,
can it like this? Maybe it's not a pbix, but it should help.
In the last column you can find excepted result, notice that I deleted vendor C for ID 3, so previous flag for day 22.09 is getting the data not from 21, but from 20.09
looking quickly at the table, it is easy not to notice that there is a column B with ID, but it's important
| Date | ID | Vendor | Product flag | Previous flag |
| 19.09.2022 | 1 | A | 1 | |
| 19.09.2022 | 1 | B | 0 | |
| 19.09.2022 | 1 | C | 1 | |
| 20.09.2022 | 2 | A | 0 | 1 |
| 20.09.2022 | 2 | B | 1 | 0 |
| 20.09.2022 | 2 | C | 0 | 1 |
| 21.09.2022 | 3 | A | 1 | 0 |
| 21.09.2022 | 3 | B | 1 | 1 |
| 22.09.2022 | 4 | A | 1 | 1 |
| 22.09.2022 | 4 | B | 0 | 1 |
| 22.09.2022 | 4 | C | 1 | 0 |