Digging through some examples found online and in the Sankey docs I put together the following general solution to your problem, albeit on my data set. In order to make a multi stage Sankey diagram I used the following approach. Add additional fields as needed, following the pattern.:
1) Pick the fields you want to link
2) Perform a stats count on all the fields you want to use, in the order you want them in
3) Build appendpipe's for each pair of fields, in the order you want and rename them to source and target
4) Set up the 'source target count' final fields output selection
5) Select the Sankey diagram on the output
index=
| stats count by
| appendpipe [stats count by | rename as source, as target]
| appendpipe [stats count by | rename as source, as target]
| appendpipe [stats count by | rename as source, as target]
| search source=*
| fields source target count
... View more