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.

1 Answer 1


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. Jul 23, 2015 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, 2015 at 8:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .