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
Ngars
Helper I
Helper I

Total combinado sin columnas pivotantes

Hola

Estoy tratando de crear un total a partir de varias columnas sin tener que pivotar dichas columnas.

Aquí hay una muestra de los datos;

EmpleadorSector IndustrialSector Industrial 2Sector Industrial 3 Categoría de tamaño del empleadorNúmero de cadetes contratadosFecha de ejecución del contratoInforme final de seguimiento recibidoEjercicio financiero
éhau NZ LimitedMedios de información y telecomunicaciones 110/03/20205/10/20202019/20
Todo el área andamios limitadosConstrucción 317/06/201929/11/20192018/19
Broadspectrum (Nueva Zelanda) LimitedServicios de electricidad, gas, agua y residuosConstrucción Más de 5015 2/07/20202020/21
Alliance Services LimitedConstrucción 29/02/202020/08/20202019/20

Estoy tratando de mostrar los totales de las tres columnas de la industria. Un ejemplo sería el total de contstructiones sería 3.

No puedo anular la pivote de las columnas porque estoy calculando la columna "Número de contratación de cadetes" para mostrar los totales de cada empleador, un pivoting crearía filas duplicadas y duplicaría los totales.

Cualquier ayuda estaría muy agradecida, abierta a otras opciones que pueden lograr el mismo resultado.

Gracias.

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hola @Ngars ,

Una pregunta con respecto al cálculo que necesita para lograr que está presentando en su ejemplo que el Total de Construcciones sería 3 es este el recuento de filas que tienen la Construcción en uno de los sectores de la Industria?

¿Cuál es el resultado que está tratando de lograr en los cálculos, es para ser utilizado en diferentes tipos de cálculos como SUM, AVERAGE, COUNT o a uno específico?

¿Y cómo desea que el filtro de valores sea por una sola columna o por todas las columnas que tenga?

He hecho un simple ejercicio haciendo un recuento de cada sector.

  • Creé una tabla desconectada con la industria utilicé el siguiente código:
Industry =
FILTER (
    DISTINCT (
        UNION (
            VALUES ( 'Table'[Industry Sector] );
            VALUES ( 'Table'[Industry Sector 2] );
            VALUES ( 'Table'[Industry Sector 3 ] )
        )
    );
    'Table'[Industry Sector] <> BLANK ()
)

Ahora agregué la siguiente medida:

Count of industry = 
VAR Industry_selection =
    VALUES ( Industry[Industry Sector] )
VAR Industry_Count =
    FILTER (
        ALLSELECTED ( 'Table'[Industry Sector]; 'Table'[Employer] );
        'Table'[Industry Sector] IN Industry_selection
    )
VAR Industry_2_Count =
    FILTER (
        ALLSELECTED ( 'Table'[Industry Sector 2]; 'Table'[Employer] );
        'Table'[Industry Sector 2] IN Industry_selection
    )
VAR Industry_3_Count =
    FILTER (
        ALLSELECTED ( 'Table'[Industry Sector 3 ]; 'Table'[Employer] );
        'Table'[Industry Sector 3 ] IN Industry_selection
    )
RETURN
    COUNTROWS ( Industry_Count ) + COUNTROWS ( Industry_2_Count )
        + COUNTROWS ( Industry_3_Count )

Como se puede ver a continuación tengo el recuento para cada industria correctamente:

Screenshot 2020-11-05 152900.png


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

7 REPLIES 7
Ngars
Helper I
Helper I

Hola @MFelix

Ok impresionante, gracias por eso! Con esa cortadora trabajando parece la solución a mi problema.

Ngars
Helper I
Helper I

Ok, so creating a seperate table might not solve my issue and I also need the Idusries to be filtered by Financial Year. 

Hola @Ngars ,

La tabla desconectada sólo está forzando que las 3 columnas se busquen para el campo comoon que es la industria, sin embargo, si nos fijamos en la parte de la fórmula donde tiene ALLSELECTED puede elegir agregar columnas adicionales con otros filtros en este caso agregue el FY:

Count of industry = 
VAR Industry_selection =
    VALUES ( Industry[Industry Sector] )
VAR Industry_Count =
    FILTER (
        ALLSELECTED ( 'Table'[Industry Sector], 'Table'[Employer] ,'Table'[Financial year]),
        'Table'[Industry Sector] IN Industry_selection
    )
VAR Industry_2_Count =
    FILTER (
        ALLSELECTED ( 'Table'[Industry Sector 2], 'Table'[Employer] , 'Table'[Financial year]),
        'Table'[Industry Sector 2] IN Industry_selection
    )
VAR Industry_3_Count =
    FILTER (
        ALLSELECTED ( 'Table'[Industry Sector 3 ], 'Table'[Employer] , 'Table'[Financial year]),
        'Table'[Industry Sector 3 ] IN Industry_selection
    )
RETURN
    COUNTROWS ( Industry_Count ) + COUNTROWS ( Industry_2_Count )
        + COUNTROWS ( Industry_3_Count )

Tiene usted puede ver en el PBIX adjuntar también funciona en la cortadora FY.

Este es un problema de contexto y por lo que para aplicar el contexto puede agregar las columnas que necesita a los valores, he hecho este enfoque para tener el ALLSELECTED basado en diferentes columnas, pero también puede colocar el nombre de la tabla en su lugar, sin embargo esto puede causar problemas de rendimiento, pero el resultado debe ser similar.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Ngars
Helper I
Helper I

I also have a slicer that filters FY, will creating a seperate Industry table affect this? 

The separate table should not affect any other values since it will only impact measures or visualizations where it's mentioned. 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



MFelix
Super User
Super User

Hola @Ngars ,

Una pregunta con respecto al cálculo que necesita para lograr que está presentando en su ejemplo que el Total de Construcciones sería 3 es este el recuento de filas que tienen la Construcción en uno de los sectores de la Industria?

¿Cuál es el resultado que está tratando de lograr en los cálculos, es para ser utilizado en diferentes tipos de cálculos como SUM, AVERAGE, COUNT o a uno específico?

¿Y cómo desea que el filtro de valores sea por una sola columna o por todas las columnas que tenga?

He hecho un simple ejercicio haciendo un recuento de cada sector.

  • Creé una tabla desconectada con la industria utilicé el siguiente código:
Industry =
FILTER (
    DISTINCT (
        UNION (
            VALUES ( 'Table'[Industry Sector] );
            VALUES ( 'Table'[Industry Sector 2] );
            VALUES ( 'Table'[Industry Sector 3 ] )
        )
    );
    'Table'[Industry Sector] <> BLANK ()
)

Ahora agregué la siguiente medida:

Count of industry = 
VAR Industry_selection =
    VALUES ( Industry[Industry Sector] )
VAR Industry_Count =
    FILTER (
        ALLSELECTED ( 'Table'[Industry Sector]; 'Table'[Employer] );
        'Table'[Industry Sector] IN Industry_selection
    )
VAR Industry_2_Count =
    FILTER (
        ALLSELECTED ( 'Table'[Industry Sector 2]; 'Table'[Employer] );
        'Table'[Industry Sector 2] IN Industry_selection
    )
VAR Industry_3_Count =
    FILTER (
        ALLSELECTED ( 'Table'[Industry Sector 3 ]; 'Table'[Employer] );
        'Table'[Industry Sector 3 ] IN Industry_selection
    )
RETURN
    COUNTROWS ( Industry_Count ) + COUNTROWS ( Industry_2_Count )
        + COUNTROWS ( Industry_3_Count )

Como se puede ver a continuación tengo el recuento para cada industria correctamente:

Screenshot 2020-11-05 152900.png


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix,

 

The construction total is a count across all three industry columns. So twice in Industry Sector and once in Industry Sector 2. 

 

The result im trying to achieve in a count of the Industry Values across the three industry columns and im also using a SUM to calculate the "Number of Cadets Contracted", hence why I couldnt use the up pivot method.

 

Your example looks like what I was trying to achieve. Ill have to run it in my main pbix file and see if it solves my issue.

 

Thanks

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.