function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Thaddeus Ward 2Thaddeus Ward 2 

SAQL error: "Cogroup projection requires stream identifier:"

I cannot figure out why I am getting this error, though I do know that the source is the highlighted generate  clause.  The query works fine without it, but throws the error with it.   (SAQL text below) 
User-added image

Open = load "opportunity";
Open = filter Open by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in ["3 years ago".."1 year ahead"];
Open = filter Open by 'IsClosed' == "false";
Open = foreach Open generate sum('Amount') as 'sum_Amount','CreatedDate_Year' as 'CreatedDate_Year','CreatedDate_Year'+"-"+'CreatedDate_Week'as 'Year_Week';
Won = load "opportunity";
Won = filter Won by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in ["3 years ago".."1 year ahead"];
Won = filter Won by 'IsWon' == "true";
Won = group Won by ('CloseDate_Year','CloseDate_Week') ;
Won = foreach Won generate 'CloseDate_Year' as 'CloseDate_Year','CloseDate_Week' as 'CloseDate_Week','CloseDate_Year'+"-"+'CloseDate_Week' as 'Year_Week', sum('Amount') as 'sum_Close';
Won = limit Won 2000;
weekgroup = cogroup Open by 'Year_Week' left, Won by 'Year_Week';
Results = foreach weekgroup generate 'Year_Week' as 'Calendar Week', coalesce(sum(Won['sum_Close']), 0) as 'sum_Amount_Closed', coalesce(coalesce(sum(Won['sum_Close']), 0) / sum(Open['sum_Amount']), 0) as 'Percent_Conversion',sum(Open['sum_Amount']) as 'Total Open';
 
VineetKumarVineetKumar
What's the error?
Thaddeus Ward 2Thaddeus Ward 2
The error is: "Cogroup projection requires stream identifier:"
Thaddeus Ward 2Thaddeus Ward 2

I found the resolution to this:  I needed to reference "Year_Week" as they are in the prior queries, as was done in the elements below.  (eg. Won['Year_Week'], etc.

 

Gargee MukherjeeGargee Mukherjee
Please provide the modified query. I am stuck with the same issue.
Carolyn McBride 9Carolyn McBride 9
I could benefit from updated syntax as well. I'm working on cogroup funtion with one dataset/multiple streams and running into the same error. 
Pratheek RPratheek R
I'm stuck with the same issue. Any advice would help. Thanks!
Mahesh_GollaMahesh_Golla
This will be the modified query.

Open = load "opportunity";
Open = filter Open by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in ["3 years ago".."1 year ahead"];
Open = filter Open by 'IsClosed' == "false";
Open = foreach Open generate sum('Amount') as 'sum_Amount','CreatedDate_Year' as 'CreatedDate_Year','CreatedDate_Year'+"-"+'CreatedDate_Week'as 'Year_Week';
Won = load "opportunity";
Won = filter Won by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in ["3 years ago".."1 year ahead"];
Won = filter Won by 'IsWon' == "true";
Won = group Won by ('CloseDate_Year','CloseDate_Week') ;
Won = foreach Won generate 'CloseDate_Year' as 'CloseDate_Year','CloseDate_Week' as 'CloseDate_Week','CloseDate_Year'+"-"+'CloseDate_Week' as 'Year_Week', sum('Amount') as 'sum_Close';
Won = limit Won 2000;
weekgroup = cogroup Open by 'Year_Week' left, Won by 'Year_Week';
Results = foreach weekgroup generate Won['Year_Week'] as 'Calendar Week', coalesce(sum(Won['sum_Close']), 0) as 'sum_Amount_Closed', coalesce(coalesce(sum(Won['sum_Close']), 0) / sum(Open['sum_Amount']), 0) as 'Percent_Conversion',sum(Open['sum_Amount']) as 'Total Open';