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
alejandroezp
Frequent Visitor

Problema con el filtrado de datos

Buenos días,

 

Tengo el siguiente problema:

Tengo una base de datos de ordenadores con los operadores que utilizan dichos ordenadores. Cada ordenador puede ser utilizado por dos, uno o ninguno. En algunos casos una misma persona puede usar más de un ordenador. Adjunto algunos datos:

Operador1                Operador2             PC

Jose Perez           Ana Fernandez           PC-1

Alba Cuesta        Jose Perez                   PC-2

                           Alba Cuesta                 PC-3

                                                               PC-4

Roberto Larcos                                       PC-5

Javier Piri           Ana Fernandez             PC-6

Alba Cuesta       Judit Becker                  PC7

Judit Becker                                            PC8

El proceso que estoy intentando con esta tabla es: Unir las columnas "Operador1", "Operador2" y descartar los operadores duplicados. A partir de aquí, filtrar entre los operadores y los ordenadores para que, seleccionando cada operador, aparezcan los ordenadores que puede usar cada uno. De tal forma que aparezcan todos los ordenadores y, cuando selecciones un operador, aparezcan los ordenadores que utiliza este operador.

El problema llega cuando realizo el filtrado. Resulta que, al seleccionar los operadores que pertenece a la columna "Operador1" filtra bien los ordenadores y muestra los que puede usar. Pero, al seleccionar un operador que pertenece a la columna "Operador2", no filtra bien y aparece que tiene 0 ordenadores.

¿Cómo puedo conseguir unir las columnas "Operador1", "Operador2" y filtrar los ordenadores para que salgan los ordenadores que usa cada uno?

 

Saludos

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

Hi, @alejandroezp 

Thanks for your sample data first.

According to your description, you want to filter the operator both in the two columns.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1685329833341.png

(2)We need to click "New Table" to create a dimension table as the slicer visual field:

Table 2 = DISTINCT( FILTER( UNION( SELECTCOLUMNS('Table',"Operator" , [Operador1]) , SELECTCOLUMNS('Table',"Operator" , [Operador2])) , [Operator]<> BLANK()))

 

(3)Then we can create a measure like this:

Measure = var _operator1= MAX('Table'[Operador1])
var _operator2= MAX('Table'[Operador2])
var _slicer = VALUES('Table 2'[Operator])
return
IF(OR( _operator1 in _slicer , _operator2 in _slicer) ,1,0)

 

(4)Then we can put the measure on the "Filter on this visual" and we can get the result is as follows:

vyueyunzhmsft_1-1685329903101.png

 

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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-yueyunzh-msft
Community Support
Community Support

Hi, @alejandroezp 

Thanks for your sample data first.

According to your description, you want to filter the operator both in the two columns.

Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1685329833341.png

(2)We need to click "New Table" to create a dimension table as the slicer visual field:

Table 2 = DISTINCT( FILTER( UNION( SELECTCOLUMNS('Table',"Operator" , [Operador1]) , SELECTCOLUMNS('Table',"Operator" , [Operador2])) , [Operator]<> BLANK()))

 

(3)Then we can create a measure like this:

Measure = var _operator1= MAX('Table'[Operador1])
var _operator2= MAX('Table'[Operador2])
var _slicer = VALUES('Table 2'[Operator])
return
IF(OR( _operator1 in _slicer , _operator2 in _slicer) ,1,0)

 

(4)Then we can put the measure on the "Filter on this visual" and we can get the result is as follows:

vyueyunzhmsft_1-1685329903101.png

 

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

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.

Top Solution Authors