Let me illustrate the several wording possibilities of the same German house here:
Dachstock Dachgeschoss Dachgeschoss Dachboden Mansarde Fahrstuhl
3. Stock[werk] 4. Geschoss 3. Obergeschoss 3. Etage 4. Etage 3
2. Stock[werk] 3. Geschoss 2. Obergeschoss 2. Etage 3. Etage 2
1. Stock[werk] 2. Geschoss 1. Obergeschoss 1. Etage 2. Etage 1
Erdgeschoss 1. Geschoss Erdgeschoss Parterre 1. Etage E/0
Keller Untergeschoss Untergeschoss Souterrain Tiefparterre -1/U/U1
2. Untergeschoss -2/U2
3. Untergeschoss -3/U3
You can easily see that there is no fixed rule. In addition the terms used may also be mixed.
When it comes to the numbering of "Geschoss", or "Etage" differences are regional. In colloquial speech people tend to also count the "Dachgeschoss" when there are both, an apartement, and a staircase to climb:
"Die Müllers müssen immer zu Fuß bis in den vierten Stock."
This is different for a "Maisonette-Wohnung" where the entrance will be second to the top floor and the top floor is accessible from a stair inside the apartment only.
To make sure you are talking about the right floor it is recommended to word it using the "Erdgeschoss/Obergeschoss/Dachgeschoss"-terminology as only then it is unequivocal what we are talking about. An "Obergeschoss" never is an "Erdgeschoss".
Regarding the top floor terminolgy there is some overlap in that we could say "Dachgeschoss" for both, the attic, and an appartement there. But this is not interchangeable for "Dachboden", which exclusively is an attic, and a "Mansarde[n-wohnung]" which always is an appartment in the top floor.
Similarly, we would not use the term "Keller" for an appartment located in the "Souterrain", "Untergeschoss", or "Tiefparterre".