I can get you partway there in the attached qvf.
1. It would be best to map the various PermID values into a new field like "Product Category" instead of using separate measures for each PermID of interest. Look at the table I added in the script. I only mapped 4 PermID, but you'll get the idea.
2. Look at my chart on the "Cost of Products (1)" sheet. I've added the new field "Product Category" as a second dimension. Now there is a single measure. To simplify, I removed some of your measure expression logic -- I didn't understand exactly what it's doing, but it seemed the only variation between measures was PermID which is now a dimension. You can try adding back the additional logic once you get the color logic sorted.
3. You'll see that selecting a single bar fades the colors as you requested. Unfortunately, when using "color by expression", QS will not generate a legend. So I made a fakey legend using a table which is not optimal.