-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFilterExceptions.pq
More file actions
16 lines (16 loc) · 1007 Bytes
/
FilterExceptions.pq
File metadata and controls
16 lines (16 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
(
Source as table,
Exceptions as table,
Columns as any,
optional ToColumns as any,
optional Filter as logical) =>
let
// Error = if not (Value.Is(Columns, type list) or Value.Is(Columns, type text)) then error "Function FilterExceptions: => Columns should be either list of column names or a single column name (text)." else null,
ColumnList = Value.Is(Columns, type list),
JoinType = if Filter <> null and not Filter then JoinKind.Inner else JoinKind.LeftAnti,
toColumns = if ToColumns = null then Columns else ToColumns,
// MergeException = if Error <> null then Error else Table.NestedJoin(Source,if ColumnList then Columns else {Columns},Exceptions,if ColumnList then toColumns else {toColumns},"tblExceptions", JoinType),
MergeException = Table.NestedJoin(Source,if ColumnList then Columns else {Columns},Exceptions,if ColumnList then toColumns else {toColumns},"tblExceptions", JoinType),
#"Removed Columns" = Table.RemoveColumns(MergeException,{"tblExceptions"})
in
#"Removed Columns"