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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Marcox28
Helper II
Helper II

transform value into char 4

Hi I have values ​​in a table that are char 3 or 2, how can I change in char 4?

example : 170 I want to turn it into 0170

 

Cattura.JPG

2 REPLIES 2
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Marcox28,

 

You can also try the function FORMAT.

Column = FORMAT([Column1], "0000")

transform_value_into_char_4

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ask4atish
Advocate III
Advocate III

Hi,

 

As per your question your values are either of 2 or 3 characters. You can use concatenate function. create a column where you should check length of your character. If it is less than 3 then concatenate it with "00" and if length of character =3 then concatenate it with "0".

 

check the below expression if this works as per your requirements.

 

column = if(LEN(your field)<3,CONCATENATE("00",your field),if(LEN(your field)=3,CONCATENATE("0",your field))). Check teh screenshot below.

 

concat.png

 

Thanks,

Atish

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.