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

Group chart bars by a dateTime

$
0
0

Hi,

I need to write an expression for the following chart below, in the following chart we have 3 categories, the PIVOT i am using has the Average of each category by DepartureDate;

to add to this the way this is done in Exel is being able to choose a data range for each bar, not sure how to do this in SSRS

Excel and SQL below

I want to say the following (as my excel chart) this is the product in EXCEL,

It is saying all for the 15th

then all including the 15th less -7 days

then all inclulding the 7-days less 28 days

as hrs,

my sql is not working:

SELECT        EmergencyAttendanceId, HospitalN, ArrivalDate, DepartureMethod, ArrivalMode, ArrivalHr, AdmWard, Ward, periodstartdate, periodstartdatetime, DepartureDate, 
                         URNumber, SeenWithinTime, AdmittedWithin4Hrs, HomeWithin4Hrs, PatientWithin4Hrs, TriageToDoctor, DoctorToBedRequest, BedRequestToDepart, 
                         IgnoreorKeepRecord, KeepRecord_Final
                         ,CASE WHEN DepartureDate>=DATEADD(Day,-1,GETDATE())then 'RunDate' else '' END AS '<1Day'
                         ,CASE WHEN DepartureDate >DATEADD(Day,-7,GETDATE()) Then '-7 Days' Else '' END AS '<7Days'
                         ,CASE WHEN DepartureDate >=DATEADD(DAy,-29,GETDATE()) THEN '-28 Days' ELSE '' END '<28Days'
FROM            EmergencyDepartment
WHERE DepartureDate  >=DATEADD(day, -30, GETDATE()) and DepartureMethod ='Admitted'
ORDER BY DepartureDate ASC


David




Viewing all articles
Browse latest Browse all 10045

Trending Articles



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