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
RobKretzRobKretz 

Help with calculation (2)

Hello! 

 

I have three different fields dependencies. Each has a score associated with it. Each are picklists 

 

1.  Core product score ( 0, 1, 2)  

2. Sub Segment (o, 1, 2) 

3. Product Class score (0, 1, 2) 

 

Say for example the the numbers come out as followed.. 

 

Core Product score = 1 

Sub Segment score = 2 

Product Class score=1 

 

Total Score= 4 

 

I'm trying to put in a validation fule on the field "TOTAL SCORE"  which would calculate/sum these three fields. 

 

Thanks in advance! 

 

-Rob

Best Answer chosen by Admin (Salesforce Developers) 
@anilbathula@@anilbathula@

HI

 

what i mean to say u have three picklist fields and with value 1,2,1 then if u want the total score as 4 .

then you need a formula field to calculate the  above three values and show as 4.

The total score field should be a formula filed then only you will get the output as 4.

so 4 is a numeric value when you create a formula field it will ask you what u want to return,like date,text,number or currency.

so if you mention number while creating formula field then you will get 4 as output.

Hope you understood this.

All Answers

@anilbathula@@anilbathula@

Hi 

 

Try this formula .

Make the total score return type as number and put this formula.

Then the total score will be the sum of all the three picklist values.

 

value(text(Product_Class_score__c ))+value(text( Sub_Segment_score__c) )+value(text( Core_product_score__c))

 

 

RobKretzRobKretz

Hi Anil,

 

Please let me know if this is correct. I went to the Field TOTAL SCORE and put in the formula below and this is my error.. 

 

(value(text(Product_Class_score__c ))+value(text( Sub_Segment_score__c) )+value(text( Core_product_score__c))

 

Error: Field Product_Class_score__c may not be used in this type of formula

 

Not sure I understand your statement of  "Make the total score return type as number". Could you please elaborate? 

 

Thanks in advance!

@anilbathula@@anilbathula@

Hi

 

Can you tell me Product_class_score__c is a picklist field or not.

what type of field is total score.

Are you doing the sum of all the fields with formula fields or with apex.

RobKretzRobKretz

Hi, 

 

The Product_Class_Score__C is a picklist  

 

Total Score is a Number field 

 

What is the difference bteween a formula field and apex? 

 

Thanks ! 

@anilbathula@@anilbathula@

Hi 

 

i think You need the count of three picklist fields as result in total score.

So please create a formula field as total score and make the return type as number and put the above form.

its already working fine in my instance.

You want sum of three fields so sum output is the number so that is the reason i told you to make return type as number.

RobKretzRobKretz

Not sure I understand your statement of  "Make the total score return type as number". Could you please elaborate? What does this mean?

 

Thank you. 

@anilbathula@@anilbathula@

HI

 

what i mean to say u have three picklist fields and with value 1,2,1 then if u want the total score as 4 .

then you need a formula field to calculate the  above three values and show as 4.

The total score field should be a formula filed then only you will get the output as 4.

so 4 is a numeric value when you create a formula field it will ask you what u want to return,like date,text,number or currency.

so if you mention number while creating formula field then you will get 4 as output.

Hope you understood this.

This was selected as the best answer
RobKretzRobKretz

Hi, 

 

Got it! 

 

Thank you!!