有没有人写过一个列公式或脚本,允许我将日期:时间转换为我公司的 OBSCURE 财政日历中的特定周或季度,称为“5-4-4”财政日历? 我看到谷歌对其他财政日历的引用,但显然 5-4-4 并不常见。
根据我对该系统的了解,您可以找到从给定年份开始的天数,然后根据每个季度的天数和长度计算周和季度。您可能需要考虑 53 周年,但这应该会让您开始:
New Table( "Fiscal Week",
Add Rows( 1000 ),
New Column( "Date", Numeric, "Continuous", Format( "yyyy-mm-ddThh:mm:ss", 19, 0 ),
Input Format( "yyyy-mm-ddThh:mm:ss", 0 ),
Formula( Date DMY( 4, 1, 2021 ) + Row() * In Hours( 12 ) )
),
New Column( "Fiscal Year", Numeric, "Continuous", Format( "Best", 12 ),
Formula(
Floor( (:Date - Date DMY( 4, 1, 2021 )) / In Days( 52 * 7 ) ) + 2021
)
),
New Column( "Fiscal Day of Year", Numeric, "Continuous", Format( "Best", 12 ),
Formula(
Floor( Mod( (:Date - Date DMY( 4, 1, 2021 )) / In Days( 1 ), 52 * 7 ) )
+ 1
),
Set Display Width( 67 )
),
New Column( "Fiscal Week of Year", Numeric, "Continuous", Format( "Best", 12 ),
Formula( Floor( (:Fiscal Day of Year - 1) / 7 ) + 1 ),
Set Display Width( 85 )
),
New Column( "Fiscal Quarter", Numeric, "Continuous", Format( "Best", 12 ),
Formula( Floor( (:Fiscal Week of Year - 1) / 13 ) + 1 ),
Set Display Width( 65 )
)
);