reporting-servicesreportssrs-2008reportbuilder

calculate the percentage base on condition in SSRS


I want to calculate the the percentage of success program

So this calculation will base on 2 fields

One is "ID" and another is "Status"

The idea is to calculate the "Finished" and "Running" over total count "ID"

the syntax will be =(count(id) if status = "Finished" + count(id) if status = "Running" ) / count(total id) /100

but i dont know how to write this in SSRS expression. any help?

So the result that im excepting is a percentage based on STATE The STATE has 3 result -- Finished Running and Failed I want to calculate the percentage of Finished + Running / total number


Solution

  • I'm not sure why you are dividing by 100 but this will give you the decimal version o of the percentage value (e.g. 0.4 = 40%). You can then format the textbox using, for example P2 (percentage with 2 decimal places) as the format property.

    =
    SUM(IIF(Fields!Status.Value = "Finished" OR Fields!Status.Value = "Running", 1, 0)) 
    / CountRows()
    

    This assumes that you want the count of all rows with a Status of "Finished" or "Running" as a percentage of the total rows in the dataset.