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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
IDTS
New Member

Creacion de Identificador unico

Buenas tardes

 

Tengo una consulta, resulta que tengo una tabla con informacion pero no tiene un unico identificador que esta en mi base de datos postgres, uso esta informacion en mi modelo de power bi, que recomedaciones me podrian dar para generar un unico identificador que no cambie al momento de volver a exportar la informacion a que genere una columna indece pero cambia en cada nueva exportacion ?

1 ACCEPTED SOLUTION
v-jtian-msft
Community Support
Community Support

Hi,@IDTS  I am glad to help you.
There are several ways to create a sorting sequence
If you can, we recommend that you start directly in the database itself, by creating a timestamp or using a UUID. This may change the structure of your data (you need to add new columns), but it is very easy to manipulate the data in a way that meets your needs.
If you don't want to change the data source you are currently using, you can also try to manipulate the data in Power BI desktop: create a new index column in Power Query.
like this:

vjtianmsft_0-1721357517859.png

Or you can create new calculated columns for sorting with DAX code (but you will need to repeat this each time you import data and create a new report).
You can use the RANKX function or the ROWNUMBER function to create new columns.
like this:
IndexID = RANKX(ALL('Table'), 'Table'[Column1] & 'Table'[Column2], , ASC, DENSE)
url:
ROWNUMBER function (DAX) - DAX | Microsoft Learn
RANKX function (DAX) - DAX | Microsoft Learn
This way is not as direct and convenient as adding sequences directly in the database, and I would recommend making changes to the data source itself.
I hope you can choose the appropriate way to realize your needs.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



View solution in original post

1 REPLY 1
v-jtian-msft
Community Support
Community Support

Hi,@IDTS  I am glad to help you.
There are several ways to create a sorting sequence
If you can, we recommend that you start directly in the database itself, by creating a timestamp or using a UUID. This may change the structure of your data (you need to add new columns), but it is very easy to manipulate the data in a way that meets your needs.
If you don't want to change the data source you are currently using, you can also try to manipulate the data in Power BI desktop: create a new index column in Power Query.
like this:

vjtianmsft_0-1721357517859.png

Or you can create new calculated columns for sorting with DAX code (but you will need to repeat this each time you import data and create a new report).
You can use the RANKX function or the ROWNUMBER function to create new columns.
like this:
IndexID = RANKX(ALL('Table'), 'Table'[Column1] & 'Table'[Column2], , ASC, DENSE)
url:
ROWNUMBER function (DAX) - DAX | Microsoft Learn
RANKX function (DAX) - DAX | Microsoft Learn
This way is not as direct and convenient as adding sequences directly in the database, and I would recommend making changes to the data source itself.
I hope you can choose the appropriate way to realize your needs.

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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