I think using the Vega-Lite fold transform is the issue; in the “second” application the “first” field does not exist, so can’t be used for the sort. Here’s an alternative that uses layers instead of the fold transform.
What I did:
• deleted the fold transform
• moved the Y-encoding outside the layer block (so it can now be shared amoung the layers)
• deleted the “size”, “order”, and “color” blocks from the encoding for the bar mark
• added a “color” for the bar mark
• added a “height” for the bar mark
• duplicated the bark mark (forecast and spending 1st [so in background], spending ytd above)
• duplicated the text mark
My solution to Deneb Workout #5 may be useful as a reference.
Hope this helps.
Greg
eDNA Forum - Deneb Sort Order.pbix (1.3 MB)