We develop a generalized dynamic factor model for panel data with the goal of estimating an unobserved index. While similar models have been developed in the literature of dynamic factor analysis, our contribution is threefold. First, contrary to simple dynamic factor analysis where multiple attributes of the same subject are measured at each time period, our model also accounts for multiple subjects. It is therefore suitable to a panel data framework. Second, our model estimates a unique unobserved index for every subject for every time period, as opposed to previous work where a temporal index common to all subjects was used. Third, we develop a novel iterative estimation process which we call the Two-Cycle Conditional Expectation-Maximization (2CCEM) algorithm and is flexible enough to handle a variety of different types of datasets. The model is applied on a panel measuring attributes related to the operation of water and sanitation utilities.