Forum Discussion
Financial Year Quarter
- 3 years ago
Hi M_SBS_6 ,
And there is another mothed to solve this question:
New a table:
Financials = DISTINCT ( CROSSJOIN ( SELECTCOLUMNS ( { 1, 3, 4, 7, 10 }, "Financial Start Month", [Value] ), SELECTCOLUMNS ( CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2022, 12, 1 ) ), "MonthName", FORMAT ( [Date], "mmm" ), "MonthNumber", MONTH ( [Date] ) ) ) )Then new a column to the new table:
Financial Quarter = "Q" & SWITCH ( [Financial Start Month], 1, QUARTER ( CONVERT ( [MonthName] & " 1", DATETIME ) ), 3, VAR m1 = [MonthNumber] - 2 RETURN QUARTER ( DATE ( 2022, IF ( m1 <= 0, m1 + 12, m1 ), 1 ) ), 4, VAR m2 = [MonthNumber] - 3 RETURN QUARTER ( DATE ( 2022, IF ( m2 <= 0, m2 + 12, m2 ), 1 ) ), 7, VAR m3 = [MonthNumber] - 6 RETURN QUARTER ( DATE ( 2022, IF ( m3 <= 0, m3 + 12, m3 ), 1 ) ), 10, VAR m4 = [MonthNumber] - 9 RETURN QUARTER ( DATE ( 2022, IF ( m4 <= 0, m4 + 12, m4 ), 1 ) ) )Then in the original table, please add the column:
Quarter = LOOKUPVALUE ( 'Financials'[Financial Quarter], Financials[Financial Start Month], [month_name], Financials[MonthNumber], MONTH ( [app_date_start] ) )The result is:
Hope this helps you. Here is my PBIX file.
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi M_SBS_6 ,
And there is another mothed to solve this question:
New a table:
Financials =
DISTINCT (
CROSSJOIN (
SELECTCOLUMNS ( { 1, 3, 4, 7, 10 }, "Financial Start Month", [Value] ),
SELECTCOLUMNS (
CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2022, 12, 1 ) ),
"MonthName", FORMAT ( [Date], "mmm" ),
"MonthNumber", MONTH ( [Date] )
)
)
)
Then new a column to the new table:
Financial Quarter =
"Q"
& SWITCH (
[Financial Start Month],
1, QUARTER ( CONVERT ( [MonthName] & " 1", DATETIME ) ),
3,
VAR m1 = [MonthNumber] - 2
RETURN
QUARTER ( DATE ( 2022, IF ( m1 <= 0, m1 + 12, m1 ), 1 ) ),
4,
VAR m2 = [MonthNumber] - 3
RETURN
QUARTER ( DATE ( 2022, IF ( m2 <= 0, m2 + 12, m2 ), 1 ) ),
7,
VAR m3 = [MonthNumber] - 6
RETURN
QUARTER ( DATE ( 2022, IF ( m3 <= 0, m3 + 12, m3 ), 1 ) ),
10,
VAR m4 = [MonthNumber] - 9
RETURN
QUARTER ( DATE ( 2022, IF ( m4 <= 0, m4 + 12, m4 ), 1 ) )
)
Then in the original table, please add the column:
Quarter =
LOOKUPVALUE (
'Financials'[Financial Quarter],
Financials[Financial Start Month], [month_name],
Financials[MonthNumber], MONTH ( [app_date_start] )
)
The result is:
Hope this helps you. Here is my PBIX file.
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.