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
Arranafc19
Helper IV
Helper IV

Crear columna para comprobar si el ID existe en otro conjunto de datos

Hola

Necesito ayuda con una consulta de modelado de datos que tengo en power bi.

Tengo dos conjuntos de datos que extraen de dos bases de datos independientes.

Mis "ChosenID" tiene una columna (ID_Number) y contiene una lista de identificadores particulares que cumplen un conjunto de requisitos.

Mi segundo conjunto de datos "ItemInformation" contiene una lista de todos los elementos, algunos de los cuales existen en el conjunto de datos "ChosenIDs".

Mi objetivo es crear una columna en el conjunto de datos "ItemInformation" que devuelve 1 o 0 dependiendo de si el identificador existe en el conjunto de datos "ChosenIDs".

¿Puede alguien aconsejar cómo se podría hacer esto? He pensado en la fusión, pero preferiría tener la columna para identificar esto .

Gracias

15 REPLIES 15
parry2k
Super User
Super User

@Arranafc19 puede compartir datos de ejemplo? Creo que entendí el problema, pero quiero estar seguro antes de proporcionar una solución.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hola @parry2k

Aquí hay una idea a continuación de cómo se ven mis conjuntos de datos en este momento y cómo me gustaría que funcionara.

"Elegidos" Dataset

Id

457

13

435

24

546

124

Conjunto de datos "ItemInformation"

ID de identificación de la identificación Nombre de la aplicación ? Precio

--------------------------------

121 ? Hyundai 15000

457 ? Toyota ? 7000

145 ? Ford 4500

99 ? BMW ? 25000

124 ? Nissan ? 3000

Cómo me gustaría que se vea con columna adicional:

ID de identificación de la identificación Nombre de la aplicación ? Precio de la casa de la página de ¿Incluido?

---------------------------------------------

121 ? Hyundai 15000 ? 0

457 ? Toyota ? 7000 ? 1

145 ? Ford 4500 ? 0

99 ? BMW ? 25000 ? 0

124 ? Nissan ? 3000 ? 1

@Arranafc19 Id en el chosenid es único o puede haber ids duplicados?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2kestos identificadores serían únicos

@Arranafc19 entonces es bastante sencillo, establece la relación entre estas dos tablas en ID y agrega la siguiente columna

Flag = 
IF ( RELATED ( ChosenId[Id] ) == BLANK(), 0, 1 )

Me gustaría elogiossi mi solución me ayudó.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para darle a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hola @parry2k

He creado la relación entre estos y traté de agregar el filtro, pero obtener el siguiente error:

La columna 'ChosenId[Id]' no existe o no tiene una relación con ninguna tabla disponible en el contexto actual.

El campo está allí y añadí la relación así que cualquier idea de por qué esto no es reconocerlo ?

@Arranafc19 puede compartir la captura de pantalla del diagrama de relaciones.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@Arranafc19 así que lo que no funciona, ahora estoy perdido, así que tenías la columna de bandera en la tabla con 0 y 1, ¿qué no está funcionando?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k la columna de la bandera no funciona:

Capture.PNG

@Arranafc19 va a agregar este indicador como una columna en la tabla ItemInformation, ¿correcto?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Sí, sí. Aquí es donde el indicador necesita comprobar cada fila para comprobar si el identificador existe en el conjunto de datos chosenid

@Arranafc19

Asegúrese de que no es una medida. También puede probar CONTAINS y LOOKUPVALUE.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Arranafc19 Hemos detectado un problema desconocido. ¿Puede compartir el archivo pbix, eliminar información confidencial antes de compartir.

Sólo para confirmar de nuevo, está agregando una columna,¿correcto?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hola @parry2k ,

El problema parece estar con el uso de la consulta directa, he cambiado para importar y esto está funcionando ahora.

Gracias por tu ayuda

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.