Forum Discussion
Anonymous
6 years agoNot applicable
switch
Hello, I would like to add a column to an existing table in the model but the error is below. Any suggestions please?: Function 'SWITCH' does not support comparing values of type Text with value...
- 6 years ago
Hi Anonymous
try CONVERT()
StartMonthDayKey = var _CalendarQuarterKey = LEFT(CONVERT('myDate'[CalendarQuarterKey], STRING), 4) RETURN SWITCH( 'myDate'[CalendarQuarterKey], 1, _CalendarQuarterKey & "0105"), 2, _CalendarQuarterKey & "0405"), 3, _CalendarQuarterKey & "0705"), 4, _CalendarQuarterKey & "1005") )
Anonymous
6 years agoNot applicable
Anonymous
6 years agoNot applicable
For the following DAX, the error is:
Function 'SWITCH' does not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values.
StartQuarterYearMonthDayKey =
VAR TextToNumber =
FORMAT ( left('Date'[Calendar Quarter Key], 4), "#" )
RETURN
SWITCH (
'Date'[CalendarQuarterKeyValue],
1, LEFT ( TextToNumber, 4 ) & "0105",
2, LEFT ( TextToNumber, 4 ) & "0405",
3, LEFT ( TextToNumber, 4 ) & "0705",
4, LEFT ( TextToNumber, 4 ) & "1005"
)