I am struggling with this query I am trying to do. I want to count how many times we went to a specific stage grouped by weeks. There is something very strange though, I can select count(stagename) which works, and also CreatedDate, which works, but when I combine them they somehow give an error.

select week_in_year(createddate), Count(StageName) from OpportunityHistory where StageName = 'x'group by week_in_year(createddate)

I hope you guys can help me with this. Thanks a lot in advance.


I copied & pasted your query to Query Editor and executed, and raised no errors.


1) How did you execute a query and raised error?

2) What happens if you try it on Query Editor?

  • This should be posted as a comment rather than as an answer. – Vigneshwaran G Jul 23 '15 at 7:39
  • Oh wow, I just typed this query from memory (I was working on it yesterday) and it turns out it works. I probably had some syntax mistakes, thanks a lot though... Sorry! – Martijn Jul 23 '15 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.