date compression cdu356

Hello, Does anybody know how codeunit 356 works? I got a question from a customer that it didn’t work the way you would expect it. For example if you want to compress the item ledger table by quarter, then the result is the same as if you would compress it by month. After studying the code it seems that it generates a datefilter by using the period of the above lying period. But because the period length of ‘period’ is normally a month, it returns also a month if you choose the period ‘Quarter’. I know it sounds a little bit cryptic, but if you look at the code, you know what I mean. I thought about changing this code into something more logical, but because this code is old and also used in previous version, I’m afraid that I miss the point about how it works. Does somebody has any suggestions[?]

I think that I discovered why it’s working this way. I think the reason is that it has something to do with financial legal aspects. For example if your accounting periods are from 15th till the 14th next month, and you want to compress by month, then it filters on the period from 1 till 14 and after that from 15 till 31 because you always have to be able to show for example how much has been sold in one acounting period.