One of the common derivations of the canonical ensemble goes as follows:
Assume there is a system in the contact with heat reservoir which together form an isolated system. Heat can be exchanged between the system and reservoir until thermal equilibrium is established and both are at temperature $T$.
Suppose system is in microstate $i$ and that it has energy $E_{i}$, energy of the reservoir is than defined as $E_R = E - E_i$. In the last equation $E$ is the energy of the total isolated system which must be constant.
We want to determine the number of microstates of the total isolated system in which the system is in microstate $i$ or the probability that isolated system will be in such a state. Number of such microstates is denoted as $\Omega_i(E)$ and is equal to the number of microstates of the reservoir $\Omega_R(E - E_i)$ since the system is in particular microstate $i$.
Total number of microstates of the isolated system is defined as: $$ \Omega (E) = \sum_{i=1} \Omega_R(E - E_i) $$
that is, it is equal to sum of the number of the reservoir microstates over every microstate of the system $i$.
Not going further into the derivation, number of microstates and probability mentioned previously are given by: $$\Omega_R(E - E_i) = \Omega_R(E)e^{- \beta E_i}$$ $$ P_i = \frac {e^{-\beta E_i}} {\sum_{j=1}^N e^{-\beta E_j}} $$
where the denominator of the previous equation is the canonical partition function $Z$ and $N$ is the number of the microstates in which the system can be.
Now, we come to my question.
According to the notation given, microstate of the system $i$ is determined by the system's energy $E_i$.
However, we know that the task of statistical thermodynamics is to connect macrostate of the system with microstates in which it can be found. Energy of the system is its macrostate and therefore such a macrostate is compatible with many different microstates in which system may be.
Because of this, energy of the system $E_i$ can't depend only on particular microstate $i$ since the same microstate can be compatible with more than one energy of the system.