You are here:
Facet Queries with Multiple Datasets
You can use a query with multiple datasets in a widget and then facet the query. The query receives filters from all of its datasets, but broadcasts selections from its first loaded dataset.
For example, suppose that the Opportunities dataset has the fields Account_Owner, Region, and Amount. The Quota dataset has the fields Name and Quota.
quo = load "Quota";
opt = load "Opportunities";
att = cogroup opt by 'Account_Owner', quo by 'Employee';
att = foreach att generate opt.'Account_Owner' as 'Owner', sum(opt.'Amount')/sum(quo.'Quota') as 'percent attained', opt.Region as 'Region'.A widget that uses this query receives filters for the following selections: A widget that uses this query broadcasts selections for Quota.Name and Quota.Quota.
- Opportunities.Name
- Opportunities.Amount
- Opportunities.Region
- Quota.Name
- Quota.Quota

