Hi June7,
I am trying to accomplish the same thing as https://www.accessforums.net/queries...26783.html#top with a large set of environmental data. I am using the same code that I got from http://www.utteraccess.com/forum/Cal...&mode=threaded.
Here is how I have it set up:
Public Function fnXPercentile(strFName As String, strTname As String, intX As Double) As Double
' dcount("*","tablename", "Field<=" & [Field] ranks
' the field between 1 and n including nulls
fnXPercentile = DMin(strFName, strTname, "Dcount(""*"", """ & strTname & """, """ & strFName & "<="" & [" & strFName & " ]) >= " & intX * DCount("*", strTname))
End Function
I call this as part of a Make Table query because I need to group my data by year to get the percentiles by year. As a test query, I am able to get the average by year (using the Totals ave query function), but only the total percentile of the entire data and not by grouping.
Can you see what I am missing here?
Thanks a million!!