sql-bi / DaxDateTemplate

Power BI template to create a Date table in DAX
MIT License
265 stars 76 forks source link

Fiscal Week #71

Closed jasonhendrix closed 1 year ago

jasonhendrix commented 1 year ago

Using the latest default PBIX file without modifications, creating a table visual that shows 'Fiscal Week Year', 'FW Year', FW StartOfWeek', and 'FW EndOfWeek', it appears that the values are duplicated for Fiscal Week Year values "FW53-2021" and "FW01-2022". Is that expected behavior?

image

If I also add the 'Date' field, I can see the following, where 1/1/2022 is the only date in "FW01-2022" but its 'FW StartOfWeek' value is not valid.

image

In my case, the report requester is looking for FW53-2021 to look as it does, but for FW01-2022 to start on 2022-01-02 instead of 2022-01-01 as it does above. Do I need to tweak settings to achieve that, or does the above situation reflect a potential bug?

A sample PBIX showing this issue is attached.
DAX Date Template - Fiscal Week Issue.zip

marcosqlbi commented 1 year ago

Thanks for reporting the issue. There is certainly a problem, and the worst news is that also Bravo for Power BI has an issue, generating another wrong result for the ISO calendar. I will try to fix the template in Bravo first, then if I have time I'll backport the changes on this template, even though I think we'll deprecate this template because Bravo provides much more flexibility. However, I'll keep you posted.

marcosqlbi commented 1 year ago

@jasonhendrix please, can you try the latest version of Bravo for Power BI v0.9.6 released today?

I tried several parameters and they work correctly. However, I noticed that your requirements do not correspond to US week numbering I am aware of - check these links: Year 2021 US Year 2022 US

These parameters generate the US calendar described above: image

For ISO Calendar, use these parameters: image

In your messsage, you said that you have 53 weeks in 2021, whereas US calendar has 53 weeks in 2022 and ISO calendar has 53 weeks in 2020.

I'd like to know which standard or rule has 53 weeks in 2021. Thanks!

Marco

jasonhendrix commented 1 year ago

Thanks for your help! Using the latest version of Bravo does seem to give us what we're looking for now.

The 53 weeks piece was probably not an accurate requirement.

marcosqlbi commented 1 year ago

Thanks - I'll check whether I can fix the calculation in the DateTemplate, but it's not a high priority now.

marcosqlbi commented 1 year ago

I finally realized that in your report you mixed a Fiscal Week column (which is not FW prefixed) with other columns that are FW prefixed. This explains the inconsistency. I can close the issue.