Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Line Chart report - Is this a time for Pivot/Unpivot or Cross apply?

$
0
0

 SSRS 2008 R2 rdl with a line chart in it

I am pulling data that looks like this where there is an unknown number of name

(select Interval, Name, Sum(Completed) as Completed 
from tblData
group by Interval, Name)

My data follows this sort of pattern.  

900   email    52
915   email    52
915   chat     32
1000 chat     5
1015 email    50
1015 chat     6

I am trying to chart this data with the Interval as the Category axis, the Name as the Series Group and Completed as the Data field.
If I have a lot of data in intervals side by side I get part of my line chart (it only seems to connect the points where the intervals are consecutive.)

So I modified the proc to return the empty intervals, but it was rather cumbersome and doesnt quite work if you have multiple Names in one table. 
0830 null 0
0845 null 0
900 email 52
915 email 52
915 chat 32

I get  the empty interval but not for each Name in the table.  Now, I did eventually get around this, but then ran into another problem.

Is this a time for a Cross Apply, Pivot/Unpivot?
I'm thinking that if I can flip my data so that is looks like below then I will have 0 in the empty intervals and my chart line will connect.

Interval Name1 Name2 Name<n>
0830     0           0         0
0845     0           0         0
0900     52         0         0
0915     52        32        0

How do i flip my data so that an unknown number of Name will grow out like a column grouping? All of the pivot/unpivot I see appear to KNOW the Name1..Name<n> but I don't.  For now, I have converted the line chart to a bar graph, but I would prefer to use a line chart.  

Thanks in advance for your time!


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>