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
Michael WebbMichael Webb 

Formula field to extract and count values in a field

I have a field on a detail (object name called spaces) record called size (this is the size of the apartment).  So I have one record that says 4, another that says 2 another that says 1 and so on, usually around 40 or 50.  I need to find a way to show on the master record how many 2's and how many 4's etc for each.  The final outcome on the master should be something like this.  Total 44, Total 2 bedrooms (amount calculated say 4) total 3 bedrooms (amount calc say 5) and so on and so on.  I have no idea how to even attack this one, not even sure where to start.

Thank you very much in advance.
Best Answer chosen by Michael Webb
logontokartiklogontokartik
Yes. this looks gr8 and so few things to consider..

On the Space object you have Size which is basically number of bedrooms (not to get confused with all the rooms). Can you change your label to Bedrooms? Also I see it as Percent field, not sure why its a percent, it could  be a number field type.


On the Property Object you can add fields

One Bedroom - Rollup Summary and see how I created (screenshot)

the same way you create Two Bedroom , Three Bedroom etc. (on filter criteria just change the size equals to 2, 3 etc)User-added image

Hope this helps

All Answers

logontokartiklogontokartik
I am not sure when you say "Amount Calculated say 4"?

from what I understand

you have detail records Spaces with size of apartment

space 1 - size 4
space 2 - size 2
space 3 - size 2
space 4 - size 1

so for the above on the master

Total 4,
2 bedrooms - 2
1 bedroom - 1
4 bedrooms - 1

is that what you want??

Deepak Kumar ShyoranDeepak Kumar Shyoran
If there is a master details relationship between these two object then you can create roll-up summary fields to calculate those values by creating the filter criteria. And if there is lookup relation then you need to create a trigger on Child object to update fields which hold the count for those child records every time when a new child records is created or updated.

Please mark this post a best solution for your question if it solves your probleml.
Michael WebbMichael Webb
I actually have one field called Size, that field could have any number, 1, 2, 3, 4, 5 etc.  
Michael WebbMichael Webb
The roll up should extract all the 1's (there could be 5 with 1's in them) and have a total 1 bedroom 5, then extract all the 2's and say Two bedroom's 4 if there are 4 of them or 5 if there are 5 of them.

Thanks!
Michael WebbMichael Webb
logontokartik exactly.. thanks
logontokartiklogontokartik
What fields do you have on the Master Object?
Do you have 1 bedroom count?, 2 Bedroom Count, 3 Bedroom count etc?
logontokartiklogontokartik
If possible can you copy paste your schema model via Schema Builder, so its easy for us to understand your model
Michael WebbMichael Webb
Is this what you are looking for?  I have not created the fields (obviously) on the Property Object as of yet.  Is this what you were looking for?  So each apartment has a new space, each space has a size, either 1, 2, 3 etc in that field.  The outcome has to be:

One bed 5
Two bed 4
Three bed 4 

Calcuated from the different amounts in the size field on the various space objects.

Thank you!

  User-added image
logontokartiklogontokartik
Yes. this looks gr8 and so few things to consider..

On the Space object you have Size which is basically number of bedrooms (not to get confused with all the rooms). Can you change your label to Bedrooms? Also I see it as Percent field, not sure why its a percent, it could  be a number field type.


On the Property Object you can add fields

One Bedroom - Rollup Summary and see how I created (screenshot)

the same way you create Two Bedroom , Three Bedroom etc. (on filter criteria just change the size equals to 2, 3 etc)User-added image

Hope this helps
This was selected as the best answer
Michael WebbMichael Webb
Oops didn't realize it was a %, I know size is silly but that is what they want.  I will try it now, thanks.
Scott Churchill 8Scott Churchill 8
I have a similar issue but in mine I do not have a master-child relationship.

To use this example, if the Spaces Object contained both the Space Field and the Size Field.  Could I create a "Similar Spaces" field that calculated how many records existed with the same size?