count with case statement in SSRS 2005
I need to count the service request depends on the status id (1,2,3,4)
how can i write a expression in textbox
count(qn_num)
where status_id = 1
count(qn_num)
where status_id = 2
count(qn_num)
where status_id = 3
count(qn_num)
where status_id = 4
i'm trying this but does not work.
=Count(IIf((Fields!status_id.Value, "PieChart") = "2", (Fields!qn_number.Value, "PieChart"), 0))
February 11th, 2011 11:03am
IS there any error or is it that the reports are not displaying the correct value?
Cheers,
Jason
P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
Free Windows Admin Tool Kit Click here and download it now
February 11th, 2011 11:28am
report is not displaying the correct value.
February 11th, 2011 11:43am
Hi,
Supposing the data is (T-SQL query):
WITH TEMP(qn_num,status_id)AS
(
SELECT 13131534,1
UNION ALL
SELECT 2352,2
UNION ALL
SELECT 23452,2
UNION ALL
SELECT 457,3
UNION ALL
SELECT 453,3
UNION ALL
SELECT 75463,3
UNION ALL
SELECT 4563,4
UNION ALL
SELECT 7837,4
UNION ALL
SELECT 4563,4
UNION ALL
SELECT 45452,4
UNION ALL
SELECT 13455,4
)
SELECT qn_num AS qn_number, status_id AS status_id
FROM TEMP
Base on above data as an example, does the expression in your post return 11? And you expect the result is 2? If yes, please change the expression to:
=Count(IIf((Fields!status_id.Value, "PieChart") = 2, (Fields!qn_number.Value, "PieChart"), Nothing))
If I have anything misunderstood, please feel free to ask.
Thanks,
Albert Ye
Free Windows Admin Tool Kit Click here and download it now
February 16th, 2011 3:11am