Based on my test, you could try this way as below:
In Edit Queries, Add an index column for main table and then duplicate the main table.
Select column A, B, C, D column Then unpivot it.
Merge it with the settings table by Attribute column
Expand the table and filter null value
Then create the relationship between main table and dup main table
Use this formula to add a calculate column
UniqueID = CONCATENATEX(RELATEDTABLE('Dup Main table'),'Dup Main table'[Value],,'Dup Main table'[Attribute])
here is pbxi file, please try it.
Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.