I would like to have the sum that shows only values for the YearMonth that has maximum value. This YearMonth is generated by mastercalendar. I don't know what is wrong, but id doesn't work. if I take Max(YearMonth) separately it shows proper value i.e. 201609, but if it is in the formula shown below - it doesn't work.