function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdev179sfdev179 

Report to display percentage of cars sold

Hello

 

I have two fields:

1.Transaction Number of Car(type autonumber)

2.Sale Price of car(type number)

 

I want to create a report to display the Percentage of cars sold to total cars.

If the sales price field contains a value,it means car was sold.Otherwise if null or 0,the car was not sold.

The total number of cars can be obtained by record count of transaction numbers of car.

But how to obtain the number of cars sold? and then calculate the required percentage?

 

Any help much appreciated.

Thanks

CheyneCheyne

If you create a summary report, you can create a formula to calculate the percentage sold. First, you'll need a formula field (for the purposes of this example, I'll call it Sold__c) that will display a number (either 0 or 1), depending on whether the car is sold. It would look something like this:

 

IF(NOT(ISBLANK(Sale_Price__c)), 1, 0)

 

Now, your report formula can divide the sum of Sold__c (since it is 1 when the car has been sold and 0 otherwise) by the record count of all cars. When customizing your summary report, double click on Formua at the top of the list of fields. In the formula editor, use the following formula:

 

ObjectName.Sold__c:SUM / RowCount * 100

 

Give the formula a name and select the option to display it at all summary levels. That should give you the percentage of cars sold.