Can anyone provide me a Formula in Universe designer (we use hana sql) to make October 1st week as week_number=1, since my Fiscal year starts from October to September.
I have to show last 4 weeks data from Current date while week_number should start from october.
I would strongly recommend building a calendar table within HANA to support this - there are tutorials on the net that show you how to do this, via your favourite search engine.
You can then integrate this calendar table into your universe and make life far easier for yourself.
We have 201801, 201802, 201803…201830,201831,201832… Calendar week.
Our Fiscal Year Starts from the October to September, and the 1st week should be October first week. And even the header name of that column should begin with October 1st week as WEEK 1.
It might be best to keep the years and months separate. Something like:
[FiscalMonth] = if [CalendarMonth]>39 then [CalendarYear] else [CalendarYear]-1
[FiscalYear] = if [CalendarMonth]>39 then [CalendarMonth]-39 else [CalendarMonth]
It depends when precisely the weeks start, so might not apply to future years.
The Formula Provided by you, is not working as the present month is a 36 week number of the year.
And moreover, the formula should by default take up the 2019-October as week 1 and September of earlier year as week -1, week-2,week-3 data, when October 2019 FY comes into picture. Since i need to show last 4 months data.
Do you need to report by week? Week is more variable than month number
Once you have month number, you could build a simple case statement for both month number and year number
Pseudo code
Financial Period
case
when month number = 10 then 1
when month number = 11 then 2
when month number = 12 then 3
when month number = 1 then 1
etc etc
Financial Year
case
when month number in (10,11,12) then calendar year
else calendar year -1
end
=If MonthNumberOfYear(Your Date Field) = 10 Then 1
ElseIf MonthNumberOfYear(Your Date Field) = 11 Then 2
ElseIf MonthNumberOfYear(Your Date Field) = 12 Then 2
ElseIf MonthNumberOfYear(Your Date Field) = 13 Then 3
ElseIf MonthNumberOfYear(Your Date Field) = 1 Then 1
Financial Year:
(Keep the CurrentDate() funtion within the Year() replace your date field in the MonthNumberofYear )
=If MonthNumberOfYear(Your Date Field) Inlist (10;11;12) Then Year(CurrentDate())
Else Year(CurrentDate())-1