Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not 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])

 

BalaKiranM_1-1671198903019.png

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not 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)
)

Eyelyn9_1-1672207717795.png

 

2. Text type:

Description =
SWITCH ( [Type], "1", "Sick", "2", "Earned", "11", "Carry Forward", [Type] )

Eyelyn9_2-1672207772122.png

 

 

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.

View solution in original post

6 REPLIES 6
Anonymous
Not 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)
)

Eyelyn9_1-1672207717795.png

 

2. Text type:

Description =
SWITCH ( [Type], "1", "Sick", "2", "Earned", "11", "Carry Forward", [Type] )

Eyelyn9_2-1672207772122.png

 

 

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.

Jihwan_Kim
Super User
Super 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]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Thanks @Jihwan_Kim But it is erroring out again, please help @amitchandak 

 

BalaKiranM_0-1671201531301.png

 

hi @Anonymous @what type of data do you have for the [type] column

Anonymous
Not applicable

It was Number, I changed to text.

the code compares it with number, so it needs to be numbers. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.