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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Luis_Caston
Helper III
Helper III

Why doesn´t makes subtotals

Dear all,

 

Take a look at this:

Luis_Caston_0-1730189936286.png

 

 

 

The point 2 is filtered by Point 1:

  • Coste Directo entradas
  • Coste Directo Salidas

 

At the Point 2 if I see any one of them individually as you can check at "II" and "III" levels I see results.

But if you pay attention at level "I" that is shrink there is no values.

 

Do you know why? Is due to the measure?

The measure that applies are:

Neto Analitica Unitario:

IF(OR(SELECTEDVALUE(Analitica[Nivel1]) = "COSTE INDIRECTO CAMPO",
SELECTEDVALUE(Analitica[Nivel1]) = "COSTE INDIRECTO SALIDAS"), CALCULATE([Neto Analitica Unitario Prev.]),
SUMX(values(Articulo[FamiliaSuperior]), [Neto Analitica Unitario Prev.]))
 
That comes from here:
 
Neto Analitica Unitario Prev. =
VAR _Calculo = SWITCH (
    SELECTEDVALUE ( Analitica[Nivel1] ),
    "VENTAS", DIVIDE([Total Venta Analitico], [Peso Neto Salidas]),
    "COSTE DIRECTO ENTRADAS", [Coste Unitario Directo Entradas Año Natural],
    "COSTE DIRECTO SALIDAS", DIVIDE( [Coste Directo Salida], [Peso Neto Salidas]),
    "MARGEN BRUTO",
        ROUND(DIVIDE([Total Venta Analitico], [Peso Neto Salidas]),2)
            - ROUND([Coste Unitario Directo Entradas Año Natural],2)
                - ROUND(DIVIDE( [Coste Directo Salida], [Peso Neto Salidas]),2),
    "COSTE INDIRECTO SALIDAS", DIVIDE([Coste Indirecto Salidas] * ( -1 ), [Peso Neto Salidas]),
    "COSTE INDIRECTO CAMPO", DIVIDE([Coste Indirecto Campo], [Peso Neto Salidas Proveedor Interno]) * (-1),
    "COSTE DIRECTO CAMPO",[Coste Unitario Directo Campo Prev.],
    "MARGEN NETO",
       ROUND(CALCULATE(ROUND(DIVIDE( [Total Venta Analitico], [Peso Neto Salidas]),2)
        - ROUND([Coste Unitario Directo Entradas Año Natural],2)
            - ROUND(DIVIDE( [Coste Directo Salida], [Peso Neto Salidas]),2)
                 - ROUND(DIVIDE([Coste Indirecto Salidas] * ( -1 ), [Peso Neto Salidas]),2)
                    + ROUND(DIVIDE([Coste Indirecto Campo], [Peso Neto Salidas Proveedor Interno]),2)
                        -  ROUND([Coste Unitario Directo Campo Prev.],2)),2))
           
RETURN
IF([Peso Neto Salidas] <> BLANK(), _Calculo, BLANK())
 
Any idea?
5 REPLIES 5
MFelix
Super User
Super User

Hi @Luis_Caston ,

 

This calculation is not getting the subtotal since you are using the SELECTEDVALUE(Analitica[Nivel1]) = "COSTE INDIRECTO CAMPO" this is forcing you calculation to check the value for Nivel1 so other levels will not get any values since they are not level 1.

 

Depending on how you have setup the other levels in this case what is identified in your table visual as I and II you need to have a SUMX of the Neto Analitica Unitario based on I and II columns


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!

So I've to make a SUMX according to I and II levels?

Hi @Luis_Caston ,

 

Yes the calculation must have a SUMX at level I and II


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 !
In this case I'm filtering the object with those both:

"COSTE DIRECTO ENTRADAS", [Coste Unitario Directo Entradas Año Natural],
    "COSTE DIRECTO SALIDAS", DIVIDE( [Coste Directo Salida], [Peso Neto Salidas]),
 
How de I must change Neto Analitico Unitario?
 
 

Hi @Luis_Caston ,

 

For I and II how is the calculation to be done a sum of the previous ones, and average? how does it calculate?


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



Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors