Average() function: where is it documented? How to average two dates?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Entering a formula like Average([numerical_column_1],[numerical_column_2]) works. However, is the formula documented anywhere? I haven't been able to find any documentation, nor can I find it in the 'functions' tab of the formula tool.
Also, is there any way to get it to work with dates? If I try the formula with two date fields, I get:
Error: Formula (19): Parse Error at char(0): Type mismatch. String provided where a number is required. (Expression #1)
which is weird because the fields are dates, not strings!
Note that I am talking about averaging two columns (an average by row), NOT about doing any kind of group by.
Thanks.
Solved! Go to Solution.
- Labels:
- Date Time
- Preparation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Alteryx stores dates as strings. You would need to convert them to a days since an epoc and then average and finally add the epoc. Something like:
DateTimeAdd("1900-01-01", Average( DateTimeDiff([Field1],"1900-01-01","days"), DateTimeDiff([Field2],"1900-01-01","days") ), "days")
The average function is documented here:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Another option is the Average Dates macro on the Gallery. This macro will average dates in a field with an optional grouping, so using it to average across two fields would require some data transformation.
For your purposes I think jdunkerley79's solution would work more elegantly.
Program Manager, Community Platform
