Have you tried the approach mention by Shinichiro in the post:
What is the outcome? Do the periods Year, quarters and Month have gap/ missing values in them?
Yes I have, but unfortunately its not in line with my requirement
Here the periods can have gaps and they do not follow the conventional calendar date data type. The periods are string format in my case