What is the most effective procedure or equivalent for "head" & "tail" in Tableau if you are try to isolate the last or first items of an vector?
The known procedure e.g. in R is easy if you are looking for an average of the last 10 numbers:
mean(head(x, 10))
or mean(tail(x, 10))
.
I try to find a solution in Tableau with LOD "max" & "min" but "show me the first 10 min items"?! No chance!
0
votes
1 Answers
0
votes
If you are talking about table calculations, then you can use the WINDOW_XXX() functions -- such as window_sum(sum(x), 1, 10)
or window_avg(sum(x), size()-9, size())
Table calcs operate on the aggregated query results returned from the data source, hence the aggregation function sum() around the field x.
It might be simpler to learn to use Top N filters instead table calcs, depending on what problem you are trying to solve.
mean(head(x, 10))
.avg(first(x, 10))
- no, thats no solution. – Teletubbi-OS Xhead(x, 10)
, and what is the equivalent for that in Tableau. Ok? And for the average:mean(head(x, 10))
– Teletubbi-OS X