Re: using SQL statement for dashboard control

That's working - at least in the sense that it's showing the SQL that I've written. However, I'm having an tough time figuring out what I'm doing incorrect. Basically, there's a sample statement in that file called Contacts by Country that I'm trying to replicate, but with some Opportunity data. I have people that have numbered their stages using 100's - e.g. 400, 500, 520, 550, 580, 600, etc. I am trying to rollup the stages by steps of 100, which I've done in SQL.

The trick is getting the chart to show correctly. I can get one chart, but the legend is just Value 1, Value 2, etc. I don't think this is a dashboard issue, rather a SQL issue, and would appreciate any assistance. I'm going to start messing with using the description possibly - e.g. 400's would *all* have a description of 400, 500's = "500" and so on.

You don't need it at all actually, when you do a group by you can exclude any return values which are an aggregate function (like sum or count). You can only specify referenced columns in the group by area of the statement.

I'm not sure I understand about stage being a number - it doesn't need to be a number for the Count function to work in SQL.

It looks like you're attempting to do a percentage calculation - you should do this in your select clause if you want it in the SQL return, but depending on your chart selection for rendering you may not need it. Let me know if you want an example of replacing the COUNT(O.[STAGE]) AS "Count" with a percentage calculation.

Re: using SQL statement for dashboard control

This user's Opp stages are all numeric (or so I think) and are like 100, 200, 300, 310, 350, 400, 420, 480, 500, etc. I'm trying to rollup an Opp stage "count" based on 100's - so all 4** will be "400", etc. I'll try the other suggestions like the case statement, but it does work on my Demo database, but I have deleted all the opps that came with the db and manually put in 3 numeric stages...