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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors