The setup: I have energy use data from a bunch of buildings built in a bunch of different years. I'd like to analyze the energy use by date constructed in Tableau. My initial problem was that there were not enough buildings in the sample to have a robust set for each year, with the resulting outputs showing a ton of noise. The distribution is skewed right, as there are a number of high outliers, but no outliers close to 0, so I'd like to use a median to reduce the effect of the few (and likely erroneous) high outliers.
Desired solution: Create a 5-year "moving" or "running" median, that includes all the buildings within two years in either direction of the given year, so that each set is centered on the year.
What I tried in Tableau: I wanted to use WINDOW_MEDIAN([ENERGY],-2,2), but it is an aggregate function. So I tried WINDOW_MEDIAN(MEDIAN([ENERGY],-2,2). Unfortunately, this gives me the median of 5 medians (Median-of-Medians?! Boo!). Again, I'd like to have the median of all individual buildings (not aggregated medians) represented in each 5-year window.
Any thoughts of how to do this? Thanks!