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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

If condition

Hi experts 

I have a column that retuens 1,2,3,4,5,6, etc

I want to have a condition that if (table[column] = 1 than return alpha

if (table[column] = 2 than return beta 

etc

having a little trouble to get the condition working and syntax working, any help appriciate 

cheers 

1 ACCEPTED SOLUTION
Anonymous
Not applicable


@Anonymous wrote:

I have changed ; to , but i get below error

thanks for reply, I get an error , "Function'swtich' does not support comparing value of type text with values of type integer, consider using value or format function to convert one of the values,

 

how do I get around it ?

 

thanks


 


@Anonymous wrote:

@Anonymous wrote:

thanks for reply, I get an error , "Function'swtich' does not support comparing value of type text with values of type integer, consider using value or format function to convert one of the values,

 

how do I get around it ?


You have to change your columns datatype to integer instead of text. Or you could use "1" instead as 1.


 

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

You could use SWITCH() instead of if

SWITCH(Table[Column];
1;"Alpha"
2;"Beta"
3;etc.
etc;etc)
Anonymous
Not applicable

I have changed ; to , but i get below error

thanks for reply, I get an error , "Function'swtich' does not support comparing value of type text with values of type integer, consider using value or format function to convert one of the values,

 

how do I get around it ?

 

thanks

Anonymous
Not applicable

thanks for reply, I get syntax error

Anonymous
Not applicable


@Anonymous wrote:

thanks for reply, I get syntax error


the ";" I use in the code might need to be a "," in your settings.

Anonymous
Not applicable


@Anonymous wrote:

thanks for reply, I get an error , "Function'swtich' does not support comparing value of type text with values of type integer, consider using value or format function to convert one of the values,

 

how do I get around it ?


You have to change your columns datatype to integer instead of text. Or you could use "1" instead as 1.

Anonymous
Not applicable


@Anonymous wrote:

I have changed ; to , but i get below error

thanks for reply, I get an error , "Function'swtich' does not support comparing value of type text with values of type integer, consider using value or format function to convert one of the values,

 

how do I get around it ?

 

thanks


 


@Anonymous wrote:

@Anonymous wrote:

thanks for reply, I get an error , "Function'swtich' does not support comparing value of type text with values of type integer, consider using value or format function to convert one of the values,

 

how do I get around it ?


You have to change your columns datatype to integer instead of text. Or you could use "1" instead as 1.


 

Anonymous
Not applicable

Perfect thanks 

used "1"

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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