nsimi
October 14, 2021, 3:08pm
1
Hello,
I am trying to determine how I could filter data tables based on another tables contents.
e.g. Lets assume I have two tables; Table A that has items 1,3,5, and 7 in it.
and Table B that has items 1,2,3,4,5, and 7 in it.
How can I filter these two tables such that I get a list of items that are either not in both or only in both?
Thank you!
I believe this is what you are looking for.
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"data": [
{
"name": "first",
"values": [
{"number": 1},
{"number": 3},
{"number": 5},
{"number": 7}
]
},
{
"name": "second",
"values": [
{"number": 1},
{"number": 2},
{"number": 3},
{"number": 4},
{"number": 5},
{"number": 7}
],
"transform": [
{
"type": "lookup",
"from": "first",
"key": "number",
"fields": ["number"],
"as": ["match"]
},
{"type": "formula", "as": "matched", "expr": "if(datum.match, 'only-both', 'not-both')"}
]
}
]
}
system
(system)
Closed
November 12, 2021, 12:16pm
3
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.