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.
Hola Amigos,
Tengo una tabla llamada "Client_Shipments" con las siguientes columnas: [Client_name], [Send_location], [Receive_location], [Coste], [Error_rate]. Estoy tratando de comprobar si para el client_name en cada fila, hay una coincidencia en la misma tabla "Client_Shipments", que tiene los mismos valores para [Send_Location], [Receive_Location], pero no tiene el mismo Client_name.
Básicamente, ¿hay otros clientes que han enviado algo desde el mismo punto de inicio y fin? Los valores [Coste] y [Error_rate] no necesitan coincidir, ya que eso es lo que quiero comparar más adelante. He creado una tabla de ejemplo a continuación, junto con la salida deseada en la columna [Match_found?].
Client_name | Send_location | Receive_location | Costo | Error_rate | Match_found? |
Client_A | acerca de | Nj | $1000 | 1% | Verdad |
Client_A | Az | el | $300 | 10% | Verdad |
Client_A | Fl | DE | $400 | 5% | Falso |
Client_B | Pero | Co | 1500 | 3% | Falso |
Client_B | Mo | Si | $500 | 1% | Falso |
Client_B | Az | el | $400 | 5% | Verdad |
Client_B | acerca de | Nj | $1200 | 1% | Verdad |
¿Alguna idea de cómo hacer que funcione? Gracias de antemano.
Solved! Go to Solution.
Hola @ndeshpande
Puede agregarlo como una nueva columna:
Match_Found_Col =
VAR cl = [Client_name]
VAR sl = [Send_location]
VAR rl = [Receive_location]
VAR c =
COUNTROWS (
CALCULATETABLE (
VALUES ( ClientOrders ),
FILTER (
ALL ( ClientOrders ),
[Send_location] = sl
&& [Receive_location] = rl
&& [Client_name] <> cl
)
)
) + 0
RETURN
IF ( c > 0, TRUE (), FALSE () )
O como medida:
Match_Found_Mes =
VAR cl =
FIRSTNONBLANK ( ClientOrders[Client_name], 1 )
VAR sl =
SELECTEDVALUE ( ClientOrders[Send_location], "123" )
VAR rl =
SELECTEDVALUE ( ClientOrders[Receive_location], "123" )
VAR c =
COUNTROWS (
CALCULATETABLE (
VALUES ( ClientOrders ),
FILTER (
ALL ( ClientOrders ),
[Send_location] = sl
&& [Receive_location] = rl
&& [Client_name] <> cl
)
)
) + 0
RETURN
IF ( c > 0, TRUE (), FALSE () )
salud
Editar: Ah, lo siento @parry2k , no había visto su respuesta.
Hola @ndeshpande
Puede agregarlo como una nueva columna:
Match_Found_Col =
VAR cl = [Client_name]
VAR sl = [Send_location]
VAR rl = [Receive_location]
VAR c =
COUNTROWS (
CALCULATETABLE (
VALUES ( ClientOrders ),
FILTER (
ALL ( ClientOrders ),
[Send_location] = sl
&& [Receive_location] = rl
&& [Client_name] <> cl
)
)
) + 0
RETURN
IF ( c > 0, TRUE (), FALSE () )
O como medida:
Match_Found_Mes =
VAR cl =
FIRSTNONBLANK ( ClientOrders[Client_name], 1 )
VAR sl =
SELECTEDVALUE ( ClientOrders[Send_location], "123" )
VAR rl =
SELECTEDVALUE ( ClientOrders[Receive_location], "123" )
VAR c =
COUNTROWS (
CALCULATETABLE (
VALUES ( ClientOrders ),
FILTER (
ALL ( ClientOrders ),
[Send_location] = sl
&& [Receive_location] = rl
&& [Client_name] <> cl
)
)
) + 0
RETURN
IF ( c > 0, TRUE (), FALSE () )
salud
Editar: Ah, lo siento @parry2k , no había visto su respuesta.
@ndeshpande puede probar el siguiente método
Añadir nueva columna y medida y medida devolverá true/false
Receive and Send Column = 'Table'[Receive_location] & 'Table'[Send_location]
Is Exist Measure =
VAR __current = VALUES ( 'Table'[Receive and Send Column] )
VAR __client = SELECTEDVALUE ( 'Table'[Client_name] )
VAR __other = CALCULATETABLE ( VALUES ( 'Table'[Receive and Send Column] ), ALL ( 'Table'[Receive and Send Column] ), 'Table'[Client_name] <> __client )
VAR __isExist = CALCULATE ( COUNTROWS ( 'Table' ), INTERSECT ( __other, __current ) ) + 0
RETURN
IF ( __isExist = 0, "False", "True" )
Me gustaría❤ elogiossi mi solución ayudara.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!
⚡Visítenos enhttps://perytus.com, su ventanilla única para proyectos/formación/consulta relacionados con Power BI.⚡
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.
Gracias por la respuesta rápida, estaba pensando que probablemente tendré que convertir la medida en una columna. Sin embargo, la combinación de los valores de columna separados relevantes en una sola columna fue una gran idea porque simplificará mis búsquedas más adelante.
¡Gracias!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |