Calculate a Percentage of Integers in a BAQ

I spent several frustrating hours try to calculate the percentage of jobs with configured parts by month. I have a BAQ with three sub-queries:

  1. One sub-qUpgradinuery gets the total number of jobs (calc-total-job-count).
  2. The second sub-query gets the total number of jobs with configured parts (calc-config-job-count).
  3. The third sub-query is the top-level and joins the above sub-queries.

In the top-level sub-query I tired to do the following calculation in order to get the percentage of configured jobs:

                Calc-config-job-count / calc-total-job-count

The result was zero. I found out that this is because my count variables are integers.

After I changed my calculation as shown below, I got a computed average. I had to convert the integers to decimal variables.

convert(decimal,ConfiguredJobs.Calculated_ConfigJobCount) / convert(decimal,AllJobsTotal.Calculated_AllJobsCount) * 100

Share This Post
Have your say!