iTunes will group tracks into albums based on the following rules:
- All tracks have the same Artist value and the same Album value, or
- All tracks have the same Album Artist value and the same Album value, or
- All tracks have the same Album value and the "Album is a compilation ..." flag is set.
In the first and third cases Album Artist can be left blank, though can be set if desired (to the same value as Artist in the first case, to "Various Artists" or similar in the third. Setting values for the Sort Album, Sort Artist and/or Sort Album Artist fields shouldn't affect grouping into albums, though it is a good idea to have consistent values (which can include blanks) for all tracks. Inconsistent values can result in tracks within a album being ordered incorrectly, even though the grouping is right. Inconsistent settings of the total tracks, disc number and total discs fields can also cause incorrect ordering. There's also evidence that iTunes 12 may, in some circumstances, fail to group albums correctly is one or more of the sorting fields are set to different values. iTunes 12 also seems to have a lurking bug such that changes to the fields that are used for grouping don't always trigger the code that makes the grouping happen. If it appears that all the rules are satisfied and an album still won't group correctly, the following "trick" may force the grouping to be correct:
- select all the tracks that should be grouped as a single album
- right-click > Get Info
- on the Details tab, edit the Album value to put a "dummy" character at the start of the name - e.g., if the correct/intended value is "Dark Side of the Moon" change it to "xDark Side of the Moon"
- click OK - in most cases the album will now be grouped correctly
- now repeat the editing process to reset the Album field to the correct value
There's a similar oddity/workaround where an album can be "forced" to group correctly by setting and then unsetting the "Album is a compilation ..." flag.