Skip to main content
Adah Kennedy (Martello) ha publicado en las noticias en tiempo real de Roman Michalik

All,

 

How do I add a filter to only return Closed won OppTs in this SAQL Syntax below

I have two datasets - OppT and User allocation(Quota).  Right now it is returning all oppts in the calculation

 

q1 = load "opportunity2";

Quota = load "quota";

result = group q1 by ('CloseDate_Year', 'CloseDate_Month') full, Quota by ('StartDate_Year', 'StartDate_Month');

result = foreach result generate coalesce(q1.'CloseDate_Year',Quota.'StartDate_Year') as 'CloseDate_Year', coalesce(q1.'CloseDate_Month',Quota.'StartDate_Month') as 'CloseDate_Month', sum(q1.'Amount') as 'sum_Amount', sum(Quota.'QuotaAmount') as 'QuotaAmount';

result = filter result by 'CloseDate_Year' in ["2019", "2020"];

result = group result by ('CloseDate_Year', 'CloseDate_Month');

result = foreach result generate 'CloseDate_Year', 'CloseDate_Month', sum('sum_Amount') as 'Won Pipe', sum('QuotaAmount') as 'QuotaAmount', coalesce(sum(sum('QuotaAmount')) over ([..-1] partition by 'CloseDate_Year' order by ('CloseDate_Year','CloseDate_Month')),0) - coalesce(sum(sum('sum_Amount')) over ([..-1] partition by 'CloseDate_Year' order by ('CloseDate_Year','CloseDate_Month')),0) + sum('QuotaAmount') as 'sum_CurrentQuota';

result = order result by ('CloseDate_Year' asc, 'CloseDate_Month' asc);

 

Thank You!

2 comentarios
0/9000