Forum Discussion
billyrich83
4 years agoFrequent Visitor
Help required
Hi all I have the below calculation for fiscal week numbers, however it start the fiscal canlendar to start on the 1st April each year and I need it to start on the 1st Monday in April each year. ...
Thejeswar
4 years agoSuper User
Hi billyrich83 ,
I just modified a little in your code and it worked
Create a new column as below
Start of Week = ('Date'[Date]+-1*WEEKDAY('Date'[Date],2)) + 1
Modified the DAX that you shared as follows
FiscalWeek =
--Inputs--
VAR WeekStartsOn = "mon"
VAR FiscalStartMonth = 4
--Calculation--
VAR FiscalFirstDay =
IF(
MONTH('Date'[Date]) < FiscalStartMonth,
DATE(
YEAR('Date'[Date])-1,
FiscalStartMonth,
1
),
DATE(
YEAR('Date'[Date]),
FiscalStartMonth,
1
)
)
VAR FilteredTableCount =
COUNTROWS(
SELECTCOLUMNS(
GENERATESERIES(
FiscalFirstDay,
'Date'[Date]
),
"Dates",
[Value]
)
)
VAR WeekNos =
QUOTIENT(FilteredTableCount+1, 7)
RETURN
"Week " & WeekNos
billyrich83
4 years agoFrequent Visitor
Hi,
Thanks for this, 1 small issue it's showing the first dayte as zero and I'm now a day behind in the calculation is there a way to fix this? it might be something I've done.
- Thejeswar4 years agoSuper User
When I checked the code, found that the hard coding that you have done works fine for one year (probably because you have hard coded based on that year) while it does not work for the other year. Have been busy since then. Hence unable to look into this further. May be someone else can get to help you with this.