Nanoindentation is a technique commonly used for measuring thin film mechanical properties such as hardness and stiffness. Typically, shallow indentations with contact depths less than 10-20% of the film thickness are used to ensure that measurements are not affected by the presence of the substrate. In this study, we have used the finite element method to investigate the effect of substrate and pile-up on hardness and stiffness measurements of thin film systems. We find that: i) for soft films on hard substrates, the hardness is independent of the substrate as long as the indentation depth is less than 50% of the film thickness; ii) as soon as the hardness exceeds that of the substrate, the substrate effect becomes significant, even for indentations as shallow as 5% of the film thickness; iii) if the film is at least 40 times harder than the substrate, the plastic zone is mostly confined to the substrate while the film conforms to the deformed substrate by bending. We define a substrate effect factor and construct a map that may be useful in the interpretation of indentation measurements on thin films. It is found that the yield stress mismatch is a key factor characterizing the hardness of thin film system, and the elastic mismatch is important when making stiffness measurements. The results obtained in this study are very useful when it is difficult to avoid the influence of the substrate on the measurements.