Hello Community,
I want to calculate how the Median has progressed over time. Other than splitting the data up by the date, then calculating median for each group of data, is there another way to do this?
I have 50+ dates and values, so will to time consuming to split up data manually then do the calculation with a summarise tool. Ideally I want to calculate the median, then add in next value, recalculate median...
ie. A median for every line.
Thanks for your help in advance,
James
Solved! Go to Solution.
Hi,
not that good in math, but I think it's more likely to be an average/mean? could you do the trick on excel and send the file to make sure of what you want?
If you use a CReW macro (http://www.chaosreignswithin.com/p/macros.html), it is easy.
The Moving Summarize tool allows you to choose which function you want to move with.
Cheers,
Mark
Hi @JamesBills
How are you calculating the values in your median column? From your post...
Ideally I want to calculate the median, then add in next value, recalculate median...
This workflow does that, calculating the monthly average by using a running total and dividing this by the number of months since the start.
However, the results diverge from yours starting in April.
Dan
I had looked at this macro, but since you had to specify a set number of "rows back" it didn't work.
As, in my use, I need to include all previous rows.
The total of the values divide by the number of records would just be the Mean.
Whereas i am looking for the Median.
So sort all the values, then take the middle value.
Hi @JamesBills
Using the sort and middle value approach the results should be
Is this what you're looking for?
Dan
Yes. Apologies made error in my excel. This is what I am looking for
Hi @JamesBills
Here you go. I had to venture into macro land for this one.
The main WF just sets things up for the batch macro
The control parameter modifies the Filter tool with each iteration. The 1st one is [RecordID]<=1, 2nd is [RecordID]<=2, etc and the Summarize tool calculates the median for all records available in this iteration. The output of each iteration is unioned with the previous ones resulting in
Dan
Thanks Dan
That image was exactly what i was thinking, thank you. Unfortunately i can't get into the workflow as I am still on 2019.1.6.
Any chance of sending over in a different format?