Forum Discussion
ThisIsIt
6 years agoFrequent Visitor
Insertar decimal
¡Buenos días! Tengo una columna de números enteros, y me gustaría insertar un decimal después del segundo dígito. ¿Cómo haría esto? Ejemplo a continuación. Actualmente el número es: 12345678 Me gustar...
- 6 years ago
@ThisIsIt - Tal vez:
DAX Column = IF([Column] = 0,0,[Column]/1000000) Power Query Column = if [Column] = 0 then 0 else [Column]/1000000
FrankAT
6 years agoCommunity Champion
Hola @ThisIsIt
si la longitud del número entero difiere, puede hacerlo con Power Query de la siguiente manera:
// Table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNjE1M7dQio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Value = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each Text.Start([Value],2) & "." & Text.End([Value],Text.Length([Value])-2)),
#"Changed Type" = Table.TransformColumnTypes(#"Added Custom",{{"Custom", type number}})
in
#"Changed Type"
o puedes hacerlo con DAX:
Decimal Number =
CONVERT (
LEFT ( CONVERT ( 'Table (2)'[Value], STRING ), 2 ) & "."
& RIGHT (
CONVERT ( 'Table (2)'[Value], STRING ),
LEN ( CONVERT ( 'Table (2)'[Value], STRING ) ) - 2
),
DOUBLE
)
Una versión más corta de la fórmula DAX anterior es:
Decimal Number =
CONVERT (
LEFT ( 'Table (2)'[Value], 2 ) & "."
& RIGHT (
'Table (2)'[Value],
LEN ('Table (2)'[Value] ) - 2
),
DOUBLE
)
Saludos FrankAT
ThisIsIt
6 years agoFrequent Visitor
Gracias a todos por sus respuestas rápidas y sugerencias. Todos trabajan para mí. ¡Realmente lo aprecias!