Forum Discussion
Combining data from different sources based on data readiness
- 5 years ago
Anonymous , I used A, B, C as table names
a New table in DAX
New Table =
var _tab1 = union(calculateTable(B, B[opportunity] in except(all(B[opportunity]),all(C[opportunity]))),C)
return
union(calculateTable(A, A[opportunity] in except(all(A[opportunity]),all(_tab1[opportunity]))),_tab1) - Anonymous5 years ago
Hi Anonymous ,
You will need to add a custom column for each table, for example tablea is 1 tableb is 2 and tablec is 3.
Then use append queries feature to combine these 3 tables.
Here's the query.
let Source = Table.Combine({#"Table a", #"Table b", #"Table c"}), #"Grouped Rows" = Table.Group(Source, {"opportunity"}, {{"max", each List.Max([Custom]), type number}, {"amount", each _, type table [opportunity=nullable text, amount=nullable number, Custom=number]}}), #"Expanded amount" = Table.ExpandTableColumn(#"Grouped Rows", "amount", {"opportunity", "amount", "Custom"}, {"amount.opportunity", "amount.amount", "amount.Custom"}), #"Added Custom" = Table.AddColumn(#"Expanded amount", "Custom", each if [max] = [amount.Custom] then 1 else 0), #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = 1)), #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"max", "amount.opportunity", "amount.Custom", "Custom"}) in #"Removed Columns"Pbix as attached.
Best Regards,
Jay
Anonymous , I used A, B, C as table names
a New table in DAX
New Table =
var _tab1 = union(calculateTable(B, B[opportunity] in except(all(B[opportunity]),all(C[opportunity]))),C)
return
union(calculateTable(A, A[opportunity] in except(all(A[opportunity]),all(_tab1[opportunity]))),_tab1)