sql-bi / Bravo

Bravo for Power BI
MIT License
354 stars 94 forks source link

4-4-5 Calendar #327

Open kw6575 opened 2 years ago

kw6575 commented 2 years ago

Describe the problem

We always start the fiscal year on Jan 1 and end the year on Dec 31 with a 4-4-5 calendar beginning on Sundays. I can not seem to get the correct result in Manage Dates. For example, for FY 2022, the program is putting Jan 1, 2022 into FY 2021 as it is a Saturday.

I understand the logic is complicated, so maybe it is not feasible but I know a lot of Manufacturers that use this Calendar.

Weekly System = 4-4-5 First Month of the Year = January First Day of Week = sunday First Day of the Fiscal Year - First of the Year Last Weekday of the Year = Closest to the Year End

Bravo version

Version: 0.9.3

Tabular model

Power BI Desktop, import mode

Power BI

Version: 2.103.881.0 64-bit (March 2022)

Steps to reproduce the behavior

No response

Additional context

No response

Screenshots

No response

Anything else ?

No response

marcosqlbi commented 2 years ago

Do you have a link to more documentation about this type of Calendar? As far as I know, if it starts on Sunday, it cannot start on the same day every year. Some examples and additional documentation would be helpful to evaluate possible implementations.

kw6575 commented 2 years ago

Thanks,

I don't have documentation, just have used this calendar at last 4 public companies I have worked at.

The year always starts on Jan 1, regardless of the day and ends on Dec 31 regardless of the day. The first and last week of the year needs to be adjusted to get back in the cycle of starting weeks on Sunday.

For example 2021

Jan 1 was a Friday which was the start of the 1st week and ran till Saturday, Jan 9. The first week had 9 days. Dec 31 was a Friday and ended the year and the last week had 6 days.

If Jan 1 is a Thursday or later would extend the 1st week, if Jan 1 is a Wednesday of earlier shorten the first week.

Keith

marcosqlbi commented 2 years ago

I have to work on it, it has several consequences. First, the code that generates the week/quarter/year attributes does not support this case, and should be completely reviewed. However, a completely different template could be a better solution, because it's a very specific use case. Second, the week no longer has 7 days every week, which creates challenges in comparison algorithms. If the current time intelligence pattern cannot be used, this is an additional effort required. Currently, the priority is to release v1 with documentation that allows other people to create customized calendars and time intelligence functions. After that, it will be easier to get additional contributions in this area. We can keep the issue open for future reviews, but it is not something we will work on in the short term.

albertospelta commented 2 years ago

I'm closing this issue temporarily and moving to the Enhancements board to track it for a future review but feel free to continue discussing it here.

kw6575 commented 2 years ago

Thanks, appreciate you looking into.