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.
I want to add "0" to third charactor position,if the legth of the text less than 6 charactors, otherwise need to dhow the original value,I wrote the sql code as below,but this did not give the current value if the length of the text more than 6
if Text.Length[AR_ID]<6 then Text.Insert(Text.From[AR_ID],2,"0") else Text.From[AR_ID]
@LAHIRU92 Well LEN is the length function. I don't believe there is an equivalent for Insert, you would likely have to use STRING_SPLIT and then stich things back together. String Functions (Transact-SQL) - SQL Server | Microsoft Learn
Here is the IF statement definition: IF...ELSE (Transact-SQL) - SQL Server | Microsoft Learn
@LAHIRU92 Pretty sure this is Power Query M code and not SQL and pretty sure you want this:
if Text.Length([AR_ID]) < 6 then Text.Insert(Text.From([AR_ID]),2,"0") else [AR_ID]
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
96 | |
78 | |
68 | |
55 |
User | Count |
---|---|
145 | |
105 | |
104 | |
90 | |
63 |