In the economic dispatch problem, the objective is to supply the demand at least cost. It is a well known fact that the solution to this problem corresponds to the generation settings that lead to equal marginal/incremental costs for all generators and for which the total generation output is equal to the total load. This provides a way to determine the solution to the economic dispatch problem by simply considering the marginal cost curves of the generators and the demand curve. In this paper, we integrate the effect of storage into this marginal cost analysis. This requires the consideration of conversion losses occurring in the storage converter, the extension to a multi-step optimization problem and the limitations imposed by the limited energy storage capacity. A method is provided by which the optimal generation and storage settings can be determined by only using marginal cost curves and the intersections thereof. Simulation results provide insights into how the theory translates into solving a multi-step optimization problem including storage.