Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
soniasweety
Master
Master

avg caluclate

Hi all,

I want to calculate the avg  age in  years     [gauge chart]

my date field  =  opendate    format [DD-MM-YYYY]

how to calculate this?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe just

= Avg( Age( Today(), opendate))

View solution in original post

6 Replies
swuehl
MVP
MVP

Maybe just

= Avg( Age( Today(), opendate))

soniasweety
Master
Master
Author

thanks but I need to calculate  the  today-Mydate    [ as avg days]

avgdays is not required ?  

Anonymous
Not applicable

Hi ,

Use below code


Date(Today(),'DD-MM-YYYY') - Date(Opendate,'DD-MM-YYYY') . Using this you will get the no'of days.

If you want to calculate in Years , Using the the IF condition you can able to retrive the year bucket.


Like IF(Date(Today(),'DD-MM-YYYY') - Date(Opendate,'DD-MM-YYYY')) <= 365 ,'< 1 Year',

IF(Date(Today(),'DD-MM-YYYY') - Date(Opendate,'DD-MM-YYYY')) > 365 and

          IF(Date(Today(),'DD-MM-YYYY') - Date(Opendate,'DD-MM-YYYY')) <= 730 , '1 to 2 Years' )



Thanks,

Venkata Sreekanth

soniasweety
Master
Master
Author

thanks its fine.

but I don't want to create if condition

I want to use as measure directly

can I use like below?

Now I got the no of days

so   =  avg(Numfday)/365     ?

rubenmarin

Hi sony, you can calculate the age in script with Age() function, and use an Avg() of this new field to calculate the average.

In front-end can be done with aggr()

Avg(Aggr(Age(Today(), opendate), FieldToIterateRecords) //IdEmployee/IdPatient...

MarcoWedel

please post some sample values and your expected result.