Forum Discussion
Anonymous
3 years agoNot applicable
Dax help in SWITCH
Experts, please help me to fix the below DAX.
Type Description =
SWITCH(
'Accrual View'[Type]=11, "Carry Forward",
'Accrual View'[Type]=2, "Earned",
'Accrual View'[Type]=1, "Sick", 'Accrual View'[Type])
- Anonymous3 years ago
Hi Anonymous ,
1.Assume the Type columm is Number type, please try:
Type Description = SWITCH ( TRUE (), 'Accrual View'[Type] = 11, "Carry Forward", 'Accrual View'[Type] = 2, "Earned", 'Accrual View'[Type] = 1, "Sick", CONVERT( 'Accrual View'[Type],STRING) )2. Text type:
Description = SWITCH ( [Type], "1", "Sick", "2", "Earned", "11", "Carry Forward", [Type] )Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 Replies
- Jihwan_KimSuper User
Hi,
If you are trying to create a new column, please try something like below.
Type Description = SWITCH ( TRUE (), 'Accrual View'[Type] = 11, "Carry Forward", 'Accrual View'[Type] = 2, "Earned", 'Accrual View'[Type] = 1, "Sick", 'Accrual View'[Type] )- AnonymousNot applicable
- FreemanZSuper User
hi Anonymous @what type of data do you have for the [type] column
- AnonymousNot applicable
Hi Anonymous ,
1.Assume the Type columm is Number type, please try:
Type Description = SWITCH ( TRUE (), 'Accrual View'[Type] = 11, "Carry Forward", 'Accrual View'[Type] = 2, "Earned", 'Accrual View'[Type] = 1, "Sick", CONVERT( 'Accrual View'[Type],STRING) )2. Text type:
Description = SWITCH ( [Type], "1", "Sick", "2", "Earned", "11", "Carry Forward", [Type] )Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.