Hi Folks,
I have Period ,FeeType, FeeDescri columns in my model. i want to add new column based on Period and Feetype.
Ex: 2022Q1 and QF then i want to add First Quarter 2002 + FeeDescri
Ex2: 202209 and MF then i want to add September 2022+ FeeDescri
Can we achive this with DAX. Please help me
Thanks in Advance.
Solved! Go to Solution.
Hi @Gopal_PV
Please refer to attached sample file with the proposed solution
Result =
VAR CurrentDescription = 'Table'[FeeDescri]
VAR CurrentPeriod = 'Table'[Period]
VAR CurrentYear = LEFT ( CurrentPeriod, 4 )
VAR MonthOrQuarter1 = SUBSTITUTE ( CurrentPeriod, CurrentYear, "" )
VAR MonthOrQuarter2 =
IF (
ISERROR ( VALUE ( CurrentPeriod) ),
SWITCH (
RIGHT ( MonthOrQuarter1, 1 ),
"1", "First Quarter",
"2", "Second Quarter",
"3", "Third Quarter",
"4", "Fourth Quarter"
),
FORMAT ( DATE ( CurrentYear, MonthOrQuarter1, 1 ), "mmmm" )
)
RETURN
MonthOrQuarter2 & " " & CurrentYear & " " & CurrentDescription
Hi @Gopal_PV
Please refer to attached sample file with the proposed solution
Result =
VAR CurrentDescription = 'Table'[FeeDescri]
VAR CurrentPeriod = 'Table'[Period]
VAR CurrentYear = LEFT ( CurrentPeriod, 4 )
VAR MonthOrQuarter1 = SUBSTITUTE ( CurrentPeriod, CurrentYear, "" )
VAR MonthOrQuarter2 =
IF (
ISERROR ( VALUE ( CurrentPeriod) ),
SWITCH (
RIGHT ( MonthOrQuarter1, 1 ),
"1", "First Quarter",
"2", "Second Quarter",
"3", "Third Quarter",
"4", "Fourth Quarter"
),
FORMAT ( DATE ( CurrentYear, MonthOrQuarter1, 1 ), "mmmm" )
)
RETURN
MonthOrQuarter2 & " " & CurrentYear & " " & CurrentDescription