Forum Discussion
kmatveyko
4 years agoFrequent Visitor
Table.Distinct with the condition in PowerQuery
Hi, I have a problem with PowerQuery. So, I need to apply Distinct function in my table. But with one condition: repeatable values should be deleted if their value is greater than 0. Plea...
- 3 years ago
this should work
Table.FromRows(List.Distinct(Table.ToRows(Source),each if _{0}=0 then Text.NewGuid() else _{0}))
kmatveyko
4 years agoFrequent Visitor
Not quite. For example, here is a column:
| 0 |
| 0 |
| 20155 |
20156 |
| 20157 |
| 20157 |
| 20157 |
| 0 |
| 20158 |
| 20159 |
Needs to delete duplicated values 20157 (two times). Nulls should stay in a column as they are.
Here is a required result:
| 0 |
| 0 |
| 20155 |
| 20156 |
| 20157 |
| 0 |
| 20158 |
| 20159 |
RenaudOne
3 years agoNew Member
this should work
Table.FromRows(List.Distinct(Table.ToRows(Source),each if _{0}=0 then Text.NewGuid() else _{0}))