Answered how to count specific values in single column

  • Friday, August 31, 2012 6:42 AM
     
     

    Dear Sir,

    I need how to count specific values in single column 

    i'd tried count functions but i don't got result 

    below mention the screen short 

    i'd tried below code

    =Count(Fields!TransitionID.Value=9)

All Replies

  • Friday, August 31, 2012 8:28 AM
     
      Has Code

    Hi,

    If you using SSRS 2008 R2, you can use below mentioned steps

    1. Add a another dataset for taking count say "DataSet2". Use the same where condition filters you have used for the main dataset.

    Select TransactionID, count(*) as cnt
    from TableName
    where Cond1, cond2, ...
    group by TransactionID

    2. Now, Add a below expression for TransactionID column

    ="The fields no. of TransactionID=" + cstr(Fields!transactionID.Value) + " is " + CSTR(Lookup(Fields!transactionID.Value,Fields!transactionID.Value,Fields!cnt.Value,"DataSet2"))


    - Chintak (My Blog)

  • Friday, August 31, 2012 11:32 AM
     
     

    Dear Sir,

    I'd tried but i'm getting error 

    The Value expression for the textrun ‘TransitionID.Paragraphs[0].TextRuns[0]’ contains an error: [BC30451] 'Lookup' is not declared. It may be inaccessible due to its protection level 

    using visual studio 2010 and vb.net

    and i need show Fields!TransitionID.Value=9 and 10 only 




    • Edited by Emalai Friday, August 31, 2012 12:51 PM
    •  
  • Friday, August 31, 2012 12:12 PM
     
     

    Hi,

    Give a try to this one

    =IIF((Fields!TransitionID.Value=9 or Fields!TransitionID.Value=10),Count(Fields!TransitionID.Value),"")



    Hope this will help you !!!
    Sanjeewan

  • Friday, August 31, 2012 12:56 PM
     
     

    Dear Sir,

    i'd tried but don't got result

    my need mention above the screen shorts
    • Edited by Emalai Friday, August 31, 2012 12:56 PM
    •  
  • Friday, August 31, 2012 2:14 PM
     
      Has Code

    Hi,

    If you want this for hardcoded 9 and 10, below is the expression

    =IIF(Fields!TransactionID.Value = 9 , "The fields no. of TransactionID=" + cstr(Fields!TransactionID.Value) + " is " +  CSTR(sum( IIF(Fields!TransactionID.Value = 9,1,0),"DataSet1")) ,  IIF(Fields!TransactionID.Value = 10 , "The fields no. of TransactionID=" + cstr(Fields!TransactionID.Value) + " is " + CSTR(sum( IIF(Fields!TransactionID.Value = 10,1,0),"DataSet1")) ,  NOTHING))
    That lookup will work for all the values, but looks like you are developing RDLC report, so that function not supported.

    - Chintak (My Blog)

  • Saturday, September 01, 2012 4:44 AM
     
     

    Hi,

    I'd tied to put your expression  one tablix2 column but i got the result is no.of  transitionID=9 have, that expresion also show same type 

    i need single row only show bottom of tablix1

    please help me

  • Sunday, September 02, 2012 11:48 PM
    Moderator
     
     Answered Has Code

    Hi There

    Thanks for your posting. Can you please use this expression

    =count(iif(Fields!TransitionID.Value=10 or Fields!TransitionID.Value=9,1,nothing))

    =count(iif(Fields!TransitionID.Value=10 or Fields!TransitionID.Value=9,1,nothing))

    A screenshot for your help

    I hope this will help.

    Many Thanks

    Syed Qazafi Anjum

    Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.


  • Monday, September 03, 2012 4:29 AM
     
     

    Thank you very much,

    It's very helpful, again lot of thanks,

    Regards,

    Emalai

  • Monday, September 03, 2012 5:01 AM
    Moderator
     
     

    Hi Emalai

    Thanks for your posting again. I am glad that your problem has been resolved. Good luck for your project.

    Many thanks

    Syed Qazafi Anjum