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

IF Statement with Text.Length and Concat

Hi Experts,

 

Below is my table in Power Query

Purushothaman_1-1648195720815.png

 

I am adding a Custom column using the if statement in Text.length, below is the power query 

Purushothaman_2-1648195787176.png

 

However, after adding the custom column I got this below error.  I even tried changing the field type into ABC or 123 but still the same error.  

Purushothaman_3-1648195998315.png

 

Anyone, Please help!!

 

Thank you

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Adjust to the below:

if Text.Length([FLT_CLS_T])  =1 then "000"&([FLT_CLS_T]) else if Text.Length([FLT_CLS_T]) =2 then   
"00"&([FLT_CLS_T]) else if Text.Length([FLT_CLS_T]) =3 then   "0"&([FLT_CLS_T]) else [FLT_CLS_T]

vluwangmsft_0-1648627565089.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Adjust to the below:

if Text.Length([FLT_CLS_T])  =1 then "000"&([FLT_CLS_T]) else if Text.Length([FLT_CLS_T]) =2 then   
"00"&([FLT_CLS_T]) else if Text.Length([FLT_CLS_T]) =3 then   "0"&([FLT_CLS_T]) else [FLT_CLS_T]

vluwangmsft_0-1648627565089.png

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

amitchandak
Super User
Super User

@Anonymous , I see come syntax error

Text.Length([FLT_CLS_T]) 

You can not text like 00

text append like

"00" & [FLT_CLS_T]

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.

Top Solution Authors