Excel 2010
I am writing my own query for the power pivot import wizard. I am basically doing a sum if there are records in my date range and a status = a certain value. The problem is my actual data only has dates for '01/01/2014 - 02/28/2014. If I add in and check where dates are outside of that range I am getting results back and cannot figure out why. Below is my query.
The last line of my select query should return '0's' as there are no 2013 dates but I am am getting a summary and I cannot figure out why that returns a value.
Select
[Assigned To],
SUM(IIF([Alert Date] Between '02/01/2014' And '02/28/2014' And Status = 'Not Started',1,0)) AS Month1_NS,
SUM(IIF([Alert Date] Between '02/01/2014' And '02/28/2014' And Status = 'In Progress',1,0)) AS Month1_IP,
SUM(IIF([Alert Date] Between '02/01/2014' And '02/28/2014' And Status = 'Completed',1,0)) AS Month1_C,
SUM(IIF([Alert Date] Between '02/01/2014' And '02/28/2014' And Status = 'Waiting',1,0)) AS Month1_W,
SUM(IIF([Alert Date] Between '02/01/2014' And '02/28/2014' And Status = 'ReWork',1,0)) AS Month1_RW,
SUM(IIF([Alert Date] Between '01/01/2014' And '01/31/2014' And Status = 'Not Started',1,0)) AS Month2_NS,
SUM(IIF([Alert Date] Between '01/01/2014' And '01/31/2014' And Status = 'In Progress',1,0)) AS Month2_IP,
SUM(IIF([Alert Date] Between '01/01/2014' And '01/31/2014' And Status = 'Completed',1,0)) AS Month2_C,
SUM(IIF([Alert Date] Between '01/01/2014' And '01/31/2014' And Status = 'Waiting',1,0)) AS Month2_W,
SUM(IIF([Alert Date] Between '01/01/2014' And '01/31/2014' And Status = 'ReWork',1,0)) AS Month2_RW,
SUM(IIF([Alert Date] Between '01/01/2013' And '01/31/2013' And Status = 'Completed',1,0)) AS Month3_C
From [tbl Pended]
Where [Route To] ='MCR'
Group By [Assigned To]
Thanks,
gjack
I am writing my own query for the power pivot import wizard. I am basically doing a sum if there are records in my date range and a status = a certain value. The problem is my actual data only has dates for '01/01/2014 - 02/28/2014. If I add in and check where dates are outside of that range I am getting results back and cannot figure out why. Below is my query.
The last line of my select query should return '0's' as there are no 2013 dates but I am am getting a summary and I cannot figure out why that returns a value.
Select
[Assigned To],
SUM(IIF([Alert Date] Between '02/01/2014' And '02/28/2014' And Status = 'Not Started',1,0)) AS Month1_NS,
SUM(IIF([Alert Date] Between '02/01/2014' And '02/28/2014' And Status = 'In Progress',1,0)) AS Month1_IP,
SUM(IIF([Alert Date] Between '02/01/2014' And '02/28/2014' And Status = 'Completed',1,0)) AS Month1_C,
SUM(IIF([Alert Date] Between '02/01/2014' And '02/28/2014' And Status = 'Waiting',1,0)) AS Month1_W,
SUM(IIF([Alert Date] Between '02/01/2014' And '02/28/2014' And Status = 'ReWork',1,0)) AS Month1_RW,
SUM(IIF([Alert Date] Between '01/01/2014' And '01/31/2014' And Status = 'Not Started',1,0)) AS Month2_NS,
SUM(IIF([Alert Date] Between '01/01/2014' And '01/31/2014' And Status = 'In Progress',1,0)) AS Month2_IP,
SUM(IIF([Alert Date] Between '01/01/2014' And '01/31/2014' And Status = 'Completed',1,0)) AS Month2_C,
SUM(IIF([Alert Date] Between '01/01/2014' And '01/31/2014' And Status = 'Waiting',1,0)) AS Month2_W,
SUM(IIF([Alert Date] Between '01/01/2014' And '01/31/2014' And Status = 'ReWork',1,0)) AS Month2_RW,
SUM(IIF([Alert Date] Between '01/01/2013' And '01/31/2013' And Status = 'Completed',1,0)) AS Month3_C
From [tbl Pended]
Where [Route To] ='MCR'
Group By [Assigned To]
Thanks,
gjack