Hello,
I'm trying to create a Chart: report that will group our workstation purchases by purchase year. So far I've come up with this, but the counts are too high. I believe it includes assets besides workstations. What's the easiest way to limit it just to workstations?
Select Top 1000000 Case
When tblAssetCustom.PurchaseDate >= Cast('01-01-2018' As DATETIME)
Then '1. Purchased in 2018'
When tblAssetCustom.PurchaseDate >= Cast('01-01-2017' As DATETIME)
And tblAssetCustom.PurchaseDate <= Cast('12-31-2017' As DATETIME) Then
'2. Purchased in 2017'
When tblAssetCustom.PurchaseDate >= Cast('01-01-2016' As DATETIME)
And tblAssetCustom.PurchaseDate <= Cast('12-31-2016' As DATETIME) Then
'3. Purchased in 2016' Else '4. Purchased in 2015 or before'
End As DateRange,
count(*) As NumberOfAssets
From tblAssetCustom
Group By Case
When tblAssetCustom.PurchaseDate >= Cast('01-01-2018' As DATETIME)
Then '1. Purchased in 2018'
When tblAssetCustom.PurchaseDate >= Cast('01-01-2017' As DATETIME)
And tblAssetCustom.PurchaseDate <= Cast('12-31-2017' As DATETIME) Then
'2. Purchased in 2017'
When tblAssetCustom.PurchaseDate >= Cast('01-01-2016' As DATETIME)
And tblAssetCustom.PurchaseDate <= Cast('12-31-2016' As DATETIME) Then
'3. Purchased in 2016' Else '4. Purchased in 2015 or before' End
Thanks!