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

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.

Reply
PowerBI123456
Post Partisan
Post Partisan

Adición de ceros iniciales en Power Query

¿Cómo puedo agregar ceros a la izquierda en Power Query solo si se cumplen determinados criterios? Por ejemplo, tengo una columna donde el número de dígitos puede variar de 10-13, pero todos ellos necesitan ser 13 dígitos. Así que si el campo contiene 10 dígitos, tendría que agregar 3 ceros a la izquierda. Si contenía 11 dígitos, tendría que añadir 2 ceros a la izquierda, etc.

¡Gracias!

1 ACCEPTED SOLUTION

@PowerBI123456 , a continuación, se hace referencia a una columna específica en la fórmula

Table.AddColumn(#"Previous step", "Leading 0s", each Number.ToText([number column], Text.Repeat("0",13)))

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

5 REPLIES 5
mahoneypat
Employee
Employee

Si necesita mantenerlos como formato numérico, también puede usar Cadenas de formato personalizado después de cargar los datos.

Usar cadenas de formato personalizado en Power BI Desktop - Power BI Documentos de Microsoft

saludos

palmadita





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


CNENFRNL
Community Champion
Community Champion

Hola, @PowerBI123456, es posible que desee seguir este patrón para dar formato a todos los números,

Number.ToText(1234567890, Text.Repeat("0",13))

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

@CNENFRNL Gracias, ¿qué pasa si quiero hacer referencia a una columna específica?

@PowerBI123456 , a continuación, se hace referencia a una columna específica en la fórmula

Table.AddColumn(#"Previous step", "Leading 0s", each Number.ToText([number column], Text.Repeat("0",13)))

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

@CNENFRNL gracias!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.