It looks like there is a cohort problem when here is more than 9 periods. It looks like cohort sorts DAY_NUMBER like string and not a string which results if we have 11 periods in a sort like: 1,10,11,2,3,4,5,6,7,8,9 and wrong cohort. Anybody have a clue how to solve it? My DAY_NUMBER is a date_diff which is not of type string.