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

Participación de ventas de un proveedor solo en las categorias en las que participa

Hola, como estan,

agradeceria que me puede ayudar en esto, quiero obtener la participación de un proveedor solo en las categorias en donde participa. Por ejemplo: este proveedor tiene ventas en 3 categorias pero el total de categorias son 11 considerando todos los proveedores, entonces necesito obtener la particpación por cada categoria del proveedor filtrado entre el total de la misma categoria donde participan todos los proveedores, quiero obtener esto a nivel categorias y a nivel total.

 

Tabla original:

Nombre ProveedorNombre LineaVta ProveedorVta todos los proveedoresPart% Prv
PEPITOACCESORIOS DEL HOGAR 1,386,781 
PEPITOACCESORIOS MODA 148,051 
PEPITOACCESORIOS TV 23,391 
PEPITOACEITES4,581,56110,363,96244.2%
PEPITOAGUAS 4,539,345 
PEPITOALIMENTOS5,6463,380,5430.2%
PEPITOALIMENTOS DE BEBES 394,945 
PEPITOARROZ 8,821,884 
PEPITOAUDIFONOS 60,395 
PEPITOAUTOMOTOR10,072316,8073.2%
PEPITOAZUCAR 4,518,614 

Total

 4,597,28033,954,71713.5%
     

 

Tabla que se requiere:

Nombre ProveedorNombre LineaVta ProveedorVta todos los proveedoresPart% Prv
PEPITOACEITES4,539,34510,363,96244.2%
PEPITOALIMENTOS5,6463,380,5430.2%
PEPITOAUTOMOTOR10,072316,8073.2%

Total

 4,597,28014,061,31232.7%
     

 

 

1 ACCEPTED SOLUTION

Hi @aluyoq,

It sound like a common measure formula calculate with multiple aggregation issue.

For this scenario, you can refer to the Greg’s blog to add a variable table with summarize function to apply the first level aggregation, then use iterator function sumx to aggregate the second level.

Measure Totals, The Final Word 

formula =
VAR summary =
    SUMMARIZE (
        ALLSELECTED ( Tabla ),
        [Nombre Proveedor],
        [Nombre Linea],
        "Result",
            CALCULATE (
                DIVIDE (
                    SUM ( Tabla[Vta Proveedor] ),
                    SUM ( Tabla[Vta todos los proveedores] )
                ),
                ALLSELECTED ( Tabla ),
                VALUES ( Tabla[Nombre Proveedor] ),
                VALUES ( Tabla[Nombre Linea] )
            )
    )
RETURN
    SUMX ( summary, [Result] )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

HI @aluyoq,

You can try to use the following measure formula to calculate the percentage based on current category(Nombre Proveedor, Nombre Linea) groups:

formula =
CALCULATE (
    DIVIDE (
        SUM ( Tabla[Vta Proveedor] ),
        SUM ( Tabla[Vta todos los proveedores] )
    ),
    ALLSELECTED ( Tabla ),
    VALUES ( Tabla[Nombre Proveedor] ),
    VALUES ( Tabla[Nombre Linea] )
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hola, las participaciones por linea estan perfectas pero el total de participación no es el correcto porque esta calculando sobre el total de ventas de todos los proveedores, es decir sale como total 13.5% deberia salir 32.7%, podria ser porque para calcular la "Vta todos los proveedores" utilizo la siguiente formula 

Vta todos los proveedores = CALCULATE(fact_venta[Venta Neta],ALL(dim_proveedor)) que formula tendria que aplicar entonces para el calculo de "Vta todos los proveedores"

 

La Tabla esta saliendo de la siguiente manera:

Nombre ProveedorNombre LineaVta ProveedorVta todos los proveedoresPart% Prv
PEPITOACEITES4,539,34510,363,96244.2%
PEPITOALIMENTOS5,6463,380,5430.2%
PEPITOAUTOMOTOR10,072316,8073.2%

Total

 4,597,28033,954,71713.5%
De salir como Total 4,597,28014,061,31232.7%

Hi @aluyoq,

It sound like a common measure formula calculate with multiple aggregation issue.

For this scenario, you can refer to the Greg’s blog to add a variable table with summarize function to apply the first level aggregation, then use iterator function sumx to aggregate the second level.

Measure Totals, The Final Word 

formula =
VAR summary =
    SUMMARIZE (
        ALLSELECTED ( Tabla ),
        [Nombre Proveedor],
        [Nombre Linea],
        "Result",
            CALCULATE (
                DIVIDE (
                    SUM ( Tabla[Vta Proveedor] ),
                    SUM ( Tabla[Vta todos los proveedores] )
                ),
                ALLSELECTED ( Tabla ),
                VALUES ( Tabla[Nombre Proveedor] ),
                VALUES ( Tabla[Nombre Linea] )
            )
    )
RETURN
    SUMX ( summary, [Result] )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help 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.