Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mikebird
Aged Yak Warrior
529 Posts |
Posted - 2010-03-11 : 06:26:01
|
I have a chunky block chart with a query giving all +ve values and have added another dataset with -ve values below to 0 line. All date periods match up. What's the best way to do it?How do you add a second dataset to a graph?Thanks |
|
mikebird
Aged Yak Warrior
529 Posts |
Posted - 2010-03-11 : 09:01:04
|
No need for a second dataset. It all gets grouped in positive and negatively seperately in one query. How to show in one chrt? Look:Select Period, SUM(Positive) FRom (Select period, CASE SIGN(adjusted_total) WHEN 1 THEN SUM(adjusted_total) ELSE 0 END as Positive From ECN_submittedGRoup by period, adjusted_total) aGroup by Period Union Select Period, SUM(Negative) negFRom (Select period, CASE SIGN(adjusted_total) WHEN -1 THEN SUM(adjusted_total) ELSE 0 END as Negative From ECN_submittedGRoup by period, adjusted_total) aGroup by PeriodOrder by PeriodPeriod (No column name)200904 0200904 2650216.85072123200905 0200905 4032462.62999999200906 0200906 3781073.43200907 -3666509.76386477200907 4599046.00494328200908 -81905.1599999999200908 3391998.91200909 0200909 5334596.87999999200910 0200910 4617094.56200911 0200911 3719311.52999999200912 0200912 4103609.11999999201001 0201001 4664465.03all I get is the date group adding all values into one column? I KNOW you can tell me how to fix this - in the query, or a chart option! |
 |
|
|
|
|