how to count specific values in single column

Отвечено how to count specific values in single column

  • 31 августа 2012 г. 6:42
     
     

    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)

Все ответы

  • 31 августа 2012 г. 8:28
     
      С кодом

    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)

  • 31 августа 2012 г. 11:32
     
     

    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 




    • Изменено Emalai 31 августа 2012 г. 12:06
    • Изменено Emalai 31 августа 2012 г. 12:07
    • Изменено Emalai 31 августа 2012 г. 12:51
    •  
  • 31 августа 2012 г. 12:12
     
     

    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

  • 31 августа 2012 г. 12:56
     
     

    Dear Sir,

    i'd tried but don't got result

    my need mention above the screen shorts
    • Изменено Emalai 31 августа 2012 г. 12:56
    •  
  • 31 августа 2012 г. 14:14
     
      С кодом

    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)

  • 1 сентября 2012 г. 4:44
     
     

    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

  • 2 сентября 2012 г. 23:48
    Модератор
     
     Отвечено С кодом

    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.


  • 3 сентября 2012 г. 4:29
     
     

    Thank you very much,

    It's very helpful, again lot of thanks,

    Regards,

    Emalai

  • 3 сентября 2012 г. 5:01
    Модератор
     
     

    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