Hello, my friends!
I have make app for counting my cattle. I want to see current age of every animal.
I want to see current age in like this format
When cow calves util 40 days, age show in like this: 23 days
After 40 days, calculate month with days: 1 month, 10 days.
After 12 month I want to see like this: 1 year, 8 month. It means 20 month age.
So, I have realise this with few separate virtual columns
Age - First calculate age in month (data type Number).
(YEAR(TODAY())-YEAR([Birthdate]))*12+MONTH(TODAY())-MONTH([Birthdate])
AgeInMonth - Age in month (I donโt know why I am use similar VC. I have make this formula 3-4 month ago, but its works)
FLOOR(((HOUR(Today() - [Birthdate])) - ([AgeInYear] * 365.25 * 24.0)) / (30.4 * 24.0))
AgeInYear -
FLOOR((HOUR(Today() - [Birthdate])) / (365.24 * 24.0))
AgeInDays -
FLOOR(((HOUR(Today() - [Birthdate])) - (([AgeInYear] * 365.24 * 24.0) + ([AgeInMonth] * 30.4 * 24.0))) / 24.0)
And after that I I have use this vc in other vc for use in interface
IF([Age] <=1, [AgeInMonth]&" days", IF(AND([Age] > 1, [Age] <12), [Age]&" months", IF(AND([Age] > 12, [Age] < 24), [AgInYear]&" year "&[AgeInMonth]&" month", [AgeInYear]&" year")))
But,some calves until a month age old, showing as 0.
Also I want ask me help with refactor this code and make calculation better
User | Count |
---|---|
62 | |
25 | |
14 | |
11 | |
6 |