Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Average of


Rui Gonçalves
 Share

Recommended Posts

Hello People! Hope you are all safe

I’m using this formula to get years and months, and it works fine

Year ( Get ( CurrentDate ) ) - Year ( Data Nasc ) - If ( Get ( CurrentDate ) < Date ( Month ( Data Nasc ) ; Day ( Data Nasc ) ; Year ( Get ( CurrentDate ) ) ) ; 1 ; 0 )

& "." &

Mod ( Month ( Get ( CurrentDate ) ) - Month ( Data Nasc) + 12 - If ( Day ( Get ( CurrentDate ) ) < Day ( Data Nasc ) ; 1 ; 0 ) ; 12 )

Now, I tried using the Summary Field – Average of, to get the average age of agroup and the result comes out 25.70, 30.25 and so on

How can I get the months under 12

Untitled_001.jpg

Link to comment
Share on other sites

I am not sure I understand your question since you appear to have solved the problem in the line items.

But, here goes...

1) Use a custom function on the resulting answer (25.7) - see "Briandunning.com" and choose one that looks promising (but test, test and test some more)

2) Convert to months multiply the fraction (0.7) by 12 to get 8.4 months; to get days multiply 0.4 months by 30 days to get 12.  (I know. I know...  Use 365 divided by 12 times the day fraction as a more accurate day number).  Here is the above logic in a FileMaker calculaton using the LET function.  I used an entry field called AGE

 

 

Let

(

[

$AgeFx = Age - Int(Age)     <-----------------------  AgeFx is age fraction;   Age is entry field or calculated average age from your app

;

$AgeMo = $AgeFx*12

;

$AgeDay = ($AgeMo - Int($AgeMo))*30

]

;

 

Int(Age) & " year(s), " & Int($AgeMo) & " month(s), " & Int($AgeDay) & " day(s)"

)

Link to comment
Share on other sites

 Share



×
×
  • Create New...

Important Information

Terms of Use