cancel
Showing results for 
Search instead for 
Did you mean: 
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 beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

5 REPLIES 5
mahoneypat
Super User
Super User

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
Super User
Super User

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 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 beyond their comprehension!

DAX is simple, but NOT EASY!

@CNENFRNL gracias!

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!

Top Kudoed Authors