SQL Report Builder Expresion
Syed,
Again, thank you for your quick reply.
I must be missing something here... where am I suppose to add this expression? My screen doesn't look anything like yours. I'm using MS Report Builder 3.0.
Steven
May 26th, 2012 9:30am
We've got a large dataset which has a record for each step in a collection of test cases along with information about the step itself. For simplicity it looks something like the following:
TC Step No Pass?
A 1 Y
A 2 Y
A 3 Y
B 1 Y
B 2 N
What I would like to do is build a report that gives me the count of unique test cases where
all of the steps have passed. In the example above the result would be 1. It's easy to get a count of the steps that have passed, but can't see to find the right expressions. Having an IF and a WHERE of FOR would
make this fairly straight forward as well.
Any help would be much appreciated.
Steven
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2012 12:18pm
Hi There
You can use this query to get the distinct count of your test cases which only have all status =Y
SELECT [TestCase]
,COUNT(DISTINCT PassStatus)DISTINCTCOUNT
FROM
[dbo].[TestCase]OUTERTEST
where
exists(
SELECT
PassStatus
from
[dbo].[TestCase] as INNERTEST
where PassStatus='y'
and INNERTEST.[TestCase]=OUTERTEST.[TestCase])
GROUP BY [TestCase]
HAVING COUNT(DISTINCT PassStatus)=1
If you have any questions please do ask.
Many Thanks
Syed Qazafi Anjum
Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
SELECT [TestCase]
,COUNT(DISTINCT PassStatus)DISTINCTCOUNT
FROM
[dbo].[TestCase]OUTERTEST
where
exists(
SELECT
PassStatus
from
[dbo].[TestCase] as INNERTEST
where PassStatus='y'
and INNERTEST.[TestCase]=OUTERTEST.[TestCase])
GROUP BY [TestCase]
HAVING COUNT(DISTINCT PassStatus)=1
--In your report you can put expression like this
=Lookup(Fields!TestCase.Value,Fields!TestCase.Value,Fields!DISTINCTCOUNT.Value, "DataSet2")
May 26th, 2012 9:41pm
Syed,
I've figured out where to put the expression, but the expression only gives you a 1 or zero Per test case. I'm looking for how many test cases have actually passed. So in your example, you have two 1's circled. I don't actually need those 1's, I just need
a single 2 at the bottom.
Starting to think that a single expression doesn't provide this.
Thanks,
Steven
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2012 3:20am
Hi Steven
I have tried to work around your problem, but was not really sure if it meets your requirement or not but please have a look.
If you think that will be alright please flick and email to me at
sqazafi@hotmail.com and I will send you the RDL file.
Please give it a go and see if it meets your requirement
Many Thanks
Syed Qazafi Anjum
Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
May 27th, 2012 5:46am
Syed,
Thanks for the response. That would have been what I tought as well, however I guess I failed to mention that this is with a data set from a Sharepoint List. So SQL itself will not work.
This is why I am looking for an expression that could be run against the dataset once it has already reached Report Builder.
Any thoughts?
Steven
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2012 6:09am
Hi There
You can try this expression inside your group
= IIF(COUNT(IIF(Fields!PassStatus.Value="N",1,NOTHING))=0,1,0)
= IIF(COUNT(IIF(Fields!PassStatus.Value="N",1,NOTHING))=0,1,0)
Many Thanks
Syed Qazafi Anjum
Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
May 27th, 2012 6:53am