Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

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...
  • Anonymous's avatar
    Anonymous
    3 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.