SSRS Count rows in colmns to get the percentage

Clive Wightman 126 Reputation points
2021-03-18T10:47:21.42+00:00

Hi

I could do with some help in getting find the expression that will,

Count the total number of Shipment_ID's in the column / by the number of 0 in GOOD_BAD_TIME * 100. to calculate the percentage. (Delivered on Time)

Aim is to calculate the percentages across the top of a report for the success rate along with % of fails with the reason (so 2% might be stuck in customs)

Regards

Clive

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,793 questions
0 comments No comments
{count} votes

Accepted answer
  1. ZoeHui-MSFT 32,426 Reputation points
    2021-03-22T07:20:37.977+00:00

    Hi @Clive Wightman ,

    Thanks for your information, please refer below expression in SSRS report.

    Count rows of GOOD_BAD_TIME where value=0 :

    =sum(iif(Fields!GOOD_BAD_TIME.value=0,1,0))  
    

    Count rows of GOOD_BAD_TIME where value=1 :

    =sum(iif(Fields!GOOD_BAD_TIME.value=1,1,0))  
    

    If I misunderstand your needs, please incorrect me.

    Regards,
    Zoe


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    What can I do if my transaction log is full?--- Hot issues November

    How to convert Profiler trace into a SQL Server table -- Hot issues November

    1 person found this answer helpful.
    0 comments No comments

7 additional answers

Sort by: Most helpful
  1. ZoeHui-MSFT 32,426 Reputation points
    2021-03-23T02:02:57.167+00:00

    Hi @Clive Wightman ,

    We should use add total to get the value you want and the expression should be like:

    =sum(iif(Fields!GOOD_BAD_TIME.value=0,1,0))/(RowNumber("YourDataSet")*100)  
    

    80386-tempaa1223.gif

    Regards,
    Zoe


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    What can I do if my transaction log is full?--- Hot issues November

    How to convert Profiler trace into a SQL Server table -- Hot issues November

    0 comments No comments

  2. Clive Wightman 121 Reputation points
    2021-03-26T14:44:56.987+00:00

    Hi Zoe,

    Thank you very much for your help, I now have this calculating as I was after.

    Regards

    Clive

    0 comments No comments

  3. Clive Wightman 121 Reputation points
    2021-03-26T16:10:17.243+00:00

    Hi Zoe

    Sorry quick one I'm getting
    =sum(Fields!C_STATUS_NAME.value="Clearance delay"))/(RowNumber("dst_PERFORMANCE"))

    0 comments No comments