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
asas27
New Member

¿Cómo realizar el porcentaje de cálculo de los recuentos de una tabla?

Hola Señor/Señora,

Tenía una tabla en el siguiente formato.

ProductoTiendaPaís de entrega
A1Nos
A1Nos
A2Canadá
A2Nos
B2Nos
B3Nos
B1Canadá
B3Canadá
B2Canadá

Entonces necesito preparar otra tabla para mostrar los siguientes datos:

ProductoPorcentaje de la tienda 1Porcentaje a EE.UU.Porcentaje de la tienda 1 a ee. UU.
A¿Cómo?¿Cómo?¿Cómo?
B¿Cómo?¿Cómo?¿Cómo?

¿Le importaría enseñarme a calcular esos % en la segunda tabla? ¡Muchas gracias!

Saludos

Catherine

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hola @asas27 ,

En primer lugar, cree una tabla de productos

Table 2 = DISTINCT('Table'[Product])

Cree una relación de uno a varios entre la tabla de productos y la tabla original.

Trate de crear medidas como esta:

Percentage from Shop 1 =
VAR count_shop1 =
    CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[Shop] = 1 ) )
VAR count_all =
    COUNTROWS ( 'Table' )
RETURN
    DIVIDE ( count_shop1, count_all )

test_How to do the calculation % of counts from a table.PNG

Ejemplo .pbix

Saludos
Liang
Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Hola @asas27 ,

En primer lugar, cree una tabla de productos

Table 2 = DISTINCT('Table'[Product])

Cree una relación de uno a varios entre la tabla de productos y la tabla original.

Trate de crear medidas como esta:

Percentage from Shop 1 =
VAR count_shop1 =
    CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[Shop] = 1 ) )
VAR count_all =
    COUNTROWS ( 'Table' )
RETURN
    DIVIDE ( count_shop1, count_all )

test_How to do the calculation % of counts from a table.PNG

Ejemplo .pbix

Saludos
Liang
Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

dedelman_clng
Community Champion
Community Champion

Hola @asas27 -

No das las respuestas que buscas específicamente, pero esto es lo que creo que quieres:

Nueva medida:

TotalSalesPct = CALCULATE(COUNTROWS('Product')) / CALCULATE(COUNTROWS(ALL('Product')))

3 imágenes de matriz

2020-08-10 14_52_56-N_and_BASE_problem (3) - Power BI Desktop.png

Espero que esto ayude

David

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.