Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.