I have a DAX SWITCH statement where I would like the result (scalar expression to be evaluated if the results of expression match the corresponding value) for the new column to be defined as the concatenation of the values in 2 columns in the table.
Example SWITCH statement:
QTD:
VAR TODAY = TODAY()
VAR Result_ =
SWITCH (
TRUE(),
'DATE'[QUARTER] = LOOKUPVALUE('DATE'[QUARTER], 'DATE'[DATE_DT], TODAY) &&
'DATE'[FISCAL_YEAR] = LOOKUPVALUE('DATE'[FISCAL_YEAR], 'DATE'[DATE_DT], TODAY) &&
'DATE'[DATE_DT] < TODAY,
**"need help with this"**,
"NA")
Return
Result_
This will return (because today is in fiscal year 2024 and quarter 3 for me):
I want “need help with this” to actually equal “2024-Q3” (FISCAL_YEAR-QUARTER) but I am not sure how to do this.
it looks like you do the calculation in the date table.
you can try below DAX
Column =
IF (
YEAR ( 'Table'[DATE_DT] ) = YEAR ( TODAY () )
&& QUARTER ( 'Table'[DATE_DT] ) = QUARTER ( TODAY () ),
"Q" & QUARTER ( 'Table'[DATE_DT] ) & " "
& YEAR ( 'Table'[DATE_DT] )
)
0
'DATE'[FISCAL_YEAR] & "-" & 'DATE'[QUARTER]
0