While all effort should be made to prevent ID’s in your DAX environment to get out of aligned, if they do then the below script might be of assistance. This script is designed to re-align table ID’s only. It should be run twice. The first run will move tables, if necessary to the end of the table list, then the second run will move then to their correct position. This is to handle the issue of another table already using the ID that should be assigned, so allows the other table to be moved out of the way so the second pass can put everything in the correct place.