We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi all,
trying to add leading Zeros in front of my live query in an extra column. The result must always 8 digits long including the leading zeros
I tried:
Number.ToText ( [Number], "0000000"))not showning zeros in front of
Number.ToText ( [Number], "d8"))not showning zeros in front of
Text.End("0" & Text.From([Number]),8)shows only one leading zero instead of multiple to fill till 8 digits are reached
Text.PadStart (Text.From( [Number]),8,"0")works, but is not allowed in live queries
Any idea how to fix this in a live query?
Solved! Go to Solution.
Hi,
Text.End("00000000" & Text.From([Number]),8)
Text.Repeat("0", 8-Text.Length(Text.From([Number]))) & Text.From([Number])
Stéphane
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMjODUKZACGFZmgGRJUzY0gKqzBhMQ0hTCNtEB6rbyMICyARrigUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type number}}),
NumberToText = Table.AddColumn(#"Changed Type", "NumberToText", each Number.ToText(Number.From([Column1]), "00000000")),
TextPadStart = Table.AddColumn(NumberToText, "TextPadStart", each Text.PadStart(Text.From([Column1]), 8, "0"))
in
TextPadStart
Hi,
Text.End("00000000" & Text.From([Number]),8)
Text.Repeat("0", 8-Text.Length(Text.From([Number]))) & Text.From([Number])
Stéphane
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 10 | |
| 8 | |
| 7 | |
| 7 | |
| 5 |