We have issues invalidating data regularly. Sometimes it works, sometimes it doesn’t. I’m not sure I see the utility in “invalidating” data anyway. If it’s invalid, just delete it! (That’s probably a naive statement, but…hey)
It is often resolved by using the plugin v.s. the command line. The “big stick” we have is deleting directly from the database tables by deleting data for a specific site, or by dropping the table entirely and re-archiving. That seems to always work when nothing else does. I had not tried that with this particular custom dimension segment issue until today.
We manually deleted the data from the archive tables for the date range we were interested in:
DELETE FROM `piwik_archive_blob_2018_06` WHERE idsite = 1234;
DELETE FROM `piwik_archive_numeric_2018_06` WHERE idsite = 1234;
By the way, in other situations we have also just dropped the entire table and re-archived all sites. Just be sure to capture both blob and numeric tables for the date range in question.
Then ran the archive on the command line
./console core:archive --force-idsites=1234
This, by the way, is why we never delete visitor logs. Disk space be damned.