I assume that your DimensionID isn't properly defined - it needs to be unique in regard to your 2 vertically and 2 horizontally dimensions. This means you might need a different table-structure for your approach.
Then try my above suggestion again and apply:
within your table. Which one returned which results?
only(DimensionID) - returns the rowno()
count(DimensionID) - returns 1 as value in each cell
concat(DimensionID, ',') - returns the rowno() - the same as received by only(DimensionID)
Ok. This means that:
should return a table with results and not just a blank table and further that your issue with the origin expression is caused by any invalid expression-variable and/or a mistake by placing the variables within the pick() which all together leads to a syntax-error for the whole expression. To find it I suggest to use my above mentioned commenting-approach within the expression.
Beside this you are trying to apply a quite large amount of different expressions. If each one is quite big you might hit any limitation in regard to the max. amount of chars within an expression. I never experienced such case but I could imagine that such things might happens. Further by larger datasets your approach might need some time to be calculated and/or hit RAM limitations for the object - but this should be clearly noticable.
Another thought goes to any comments within the variables which may not bother by using them as a single expression but by including them within other calculations they could cause problems, see: Well-commented-variables-Be-careful.