Forum Discussion
Anonymous
6 years agoNot applicable
Recreating Case Statement in Dax
Hi, I'm trying to recreate the following case statement in dax 'FY ' + cast(CASE WHEN MONTH(jb.date_comp) > 3 THEN YEAR(jb.date_comp) + 1 ELSE YEAR(jb.date_comp) END as varchar) AS COMP_FIS...
- 6 years ago
Anonymous add new column with following expresssion
Would appreciate Kudos 🙂 if my solution helped.
COMP_FISCAL_YEAR_TEXT = VAR __month = MONTH(jb[date_comp]) VAR __year = YEAR(jb[date_comp]) RETURN 'FY ' & IF ( __month > 3, __year + 1, __year ) COMP_FISCAL_PERIOD = SWITCH ( MONTH(jb[date_comp]) , 1 , 'P10 Jan' 2 , 'P11 Feb' 3 , 'P12 Mar' 4 , 'P01 Apr' 5 , 'P02 May' 6 , 'P03 Jun' 7 , 'P04 Jul' 8 , 'P05 Aug' 9 , 'P06 Sep' 10 , 'P07 Oct' 11 , 'P08 Nov' 12 , 'P09 Dec', '0' )
parry2k
Super User
6 years agoAnonymous add new column with following expresssion
Would appreciate Kudos 🙂 if my solution helped.
COMP_FISCAL_YEAR_TEXT =
VAR __month = MONTH(jb[date_comp])
VAR __year = YEAR(jb[date_comp])
RETURN
'FY ' & IF ( __month > 3, __year + 1, __year )
COMP_FISCAL_PERIOD =
SWITCH ( MONTH(jb[date_comp]) ,
1 , 'P10 Jan'
2 , 'P11 Feb'
3 , 'P12 Mar'
4 , 'P01 Apr'
5 , 'P02 May'
6 , 'P03 Jun'
7 , 'P04 Jul'
8 , 'P05 Aug'
9 , 'P06 Sep'
10 , 'P07 Oct'
11 , 'P08 Nov'
12 , 'P09 Dec',
'0'
)