Forum Discussion
Delete columns if they exist
- 9 years ago
What you may actually want is to "unpivot" all of your CSVs before merging them. When you go to create measures, it could be problematic if you have a "wide" data set with specific columns, rather than a "narrow" dataset with a "TimeType" column and the value. For example:
Emp Name Online Meeting Offline Joe 2 1 1 Emp Name Online Away OutofOffice Mary 3 1 0.5
"unpivots" (Transform tab, highlight columns, click "Unpivot Columns") to
EmpName TimeType Hours Joe Online 2 Joe Meeting 1 Joe Offline 1 EmpName TimeType Hours Mary Online 3 Mary Away 1 Mary Offline 0.5
which can easily be merged.
Hope this helps,
David
- 9 years ago
Alternatively: Table.RemoveColumns has a parameter missingField with possible values (and shortcuts 0,1,2):
MissingField.Error (0)
MissingField.Ignore (1)
MissingField.UseNull (2)
It looks like you could use MissingField.Ignore (or its shortcut: 1).
What you may actually want is to "unpivot" all of your CSVs before merging them. When you go to create measures, it could be problematic if you have a "wide" data set with specific columns, rather than a "narrow" dataset with a "TimeType" column and the value. For example:
Emp Name Online Meeting Offline Joe 2 1 1 Emp Name Online Away OutofOffice Mary 3 1 0.5
"unpivots" (Transform tab, highlight columns, click "Unpivot Columns") to
EmpName TimeType Hours Joe Online 2 Joe Meeting 1 Joe Offline 1 EmpName TimeType Hours Mary Online 3 Mary Away 1 Mary Offline 0.5
which can easily be merged.
Hope this helps,
David
Alternatively: Table.RemoveColumns has a parameter missingField with possible values (and shortcuts 0,1,2):
MissingField.Error (0)
MissingField.Ignore (1)
MissingField.UseNull (2)
It looks like you could use MissingField.Ignore (or its shortcut: 1).