Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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...
  • az38's avatar
    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")
    )