I want to create fiscal year from start-date 01-Jul-2015 to end-date 30-Jun-2017
i have this code now i modified this code according to the give fiscal year
Cal =
ADDCOLUMNS (
CALENDARAUTO ( 3 ),
"MIndex", MONTH ( EDATE ( [Date], -3 ) ),
"CalMonth", FORMAT ( [Date], "mmm" ),
"CalQtr", "Q"
& CEILING ( MONTH ( [Date] ), 3 ) / 3,
"CalYear", YEAR ( [Date] ),
"FinQtr", "Q"
& CEILING ( MONTH ( EDATE ( [Date], -3 ) ), 3 ) / 3,
"FY",
VAR CY =
RIGHT ( YEAR ( [Date] ), 2 )
VAR NY =
RIGHT ( YEAR ( [Date] ) + 1, 2 )
VAR PY =
RIGHT ( YEAR ( [Date] ) - 1, 2 )
VAR FinYear =
IF ( MONTH ( [Date] ) > 3, CY & "-" & NY, PY & "-" & CY )
RETURN
FinYear,
"FinWeekNo", WEEKNUM ( EDATE ( [Date], -3 ), 2 ),
"CalWeekNo", WEEKNUM ( [Date], 2 ),
"Weekend/Working", IF ( WEEKDAY ( [Date], 2 ) > 5, "Weekend", "Working" ),
"Day", FORMAT ( [Date], "ddd" ),
"CustomDate", FORMAT ( [Date], "d/mm" )
)
now how i modified above code
You use the CALENDARAUTO(3) function where the argument defines the fiscal year as ending in March. Other than that it also looks at all the datetime columns of your model, and defines the date range accordingly. If you want to hardcode your daterange, just change
CALENDARAUTO(3)
to
CALENDAR("2015-07-01", "2017-06-30")
You might also add each of these as calculated columns instead. That would make reading the code a lot easier.