Forum Discussion
Function To Calculate Fiscal Week
Phil_Seamark My data skip dates, because not every day we receive purchases. Example Date/Calendar table:
In Power BI
Hi, please try this calculated column in your table and let me know
WeeKFY2 =
VAR WeekStartinFY =
WEEKNUM ( DATE ( Calendario[FiscalYear], 7, 1 ), 2 )
RETURN
IF (
Calendario[WeeK] < WeekStartinFY,
WeekStartinFY + Calendario[WeeK]
+ 1,
Calendario[WeeK] - WeekStartinFY
+ 1
)
- Vvelarde9 years agoCommunity Champion
Yes, the formula need some adjustment.
WeeKFY2 = VAR WeekStartinFY = WEEKNUM ( DATE ( Calendario[FiscalYear], 7, 1 ); 2 ) RETURN IF ( Calendario[WeeK] < WeekStartinFY, WeekStartinFY + Calendario[WeeK], Calendario[WeeK] - WeekStartinFY + 1 )Now Appears.But don't know if this the solution to Julian's Question.
- JulianTobon9 years agoHelper I
- JulianTobon9 years agoHelper I
Phil_Seamark excuseme, Your form is a little more successful, what I can detect in it is that it starts the count of the week on Sunday, but it should start on Monday. We have to indicate that in the Formula?
- Vvelarde9 years agoCommunity Champion
- Sean9 years agoCommunity Champion
- JulianTobon9 years agoHelper I
We are on the right track, but as you can see an error is generated at the calendar year change. For example is January 1 should be week 27 and the formula detects it as 28 and changes the next day to 29.
- JulianTobon9 years agoHelper I
Sean No :smileysad:
- gimpexe8 years agoFrequent Visitor
any development on this? ive got the same issue.
trying to create a column for Fiscal Week 1-53, starting on July 1st.
- freshwave8 years agoHelper I
For me this worked perfectly. For crossing over the Calendar Year you need to subtract one.
WeeKFY2 = VAR WeekStartinFY = WEEKNUM ( DATE ( Calendario[FiscalYear], 7, 1 ), 2 ) RETURN IF ( Calendario[WeeK] < WeekStartinFY, WeekStartinFY + Calendario[WeeK] - 1, Calendario[WeeK] - WeekStartinFY + 1 ) - freshwave8 years agoHelper I
I was able to get the same results in Power Query with the following code:
InsertFiscalWeek = Table.AddColumn(PreviousItem, "FiscalWeek", each if [Week] < Date.WeekOfYear(#date([FiscalYear], 7, 1))
then [Week] + Date.WeekOfYear(#date([FiscalYear], 7, 1)) - 1
else [Week] - Date.WeekOfYear(#date([FiscalYear], 7, 1)) + 1, Int64.Type) - Hanuma7 years agoRegular Visitor
JulianTobon Hi ,
Please share the solution if you have the solution for the fiscal week starts with monday
thanks