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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Fragan
Helper III
Helper III

Se calcula el sub total de filas igual es

Oye

Tengo esta tabla :

LdjDX

Y quiero calcular foreach day y foreach group 1and2 % que es (Attribute1/Attribute2)*100

Y quiero incluir '1 y 2 %' en El Subtotal del Grupo y en el total

He creado una nueva tabla:

He creado una nueva tabla:

Tabla3 - UNION(DISTINCT('Table'[Attributes]);? "1 y 2 %"-)

E hice este control para calcular 1y2 %:

Medida : 
SUMX (
    DISTINCT ( 'Table3'[Attributes] );
    SWITCH (
        'Tabla3'[Atributos];
        " 1 y 2 %"; IFERROR((CALCULATE ( SUM ( 'Table'[Value] ); 'Tabla'[Atributos] - "Atributo1" )
            / CALCULAR ( SUM ( 'Tabla'[Valor] ); 'Tabla'[Atributos] - "Atributo2" ))*100;0);
            var a á 'Table3'[Attributes] return
        CALCULATE ( SUM ( 'Table'[Value] );' Tabla'[Atributos]-a)
) )

Y este es el resultado im obtener :

F2fQS

Quiero excluir el 1 y 2 % (y cada atributo que contenga % en el futuro) del subtotal del grupo y del total.

Soy realmente nuevo en PowerBI y no estoy familiarizado con Excel como fórmulas.. ¿Alguien puede por favor ayudarme con eso ?

saludos

1 ACCEPTED SOLUTION

OK, echando un vistazo al post original, tal vez algo como:

Measure 2 =
VAR __Table =
  ADDCOLUMNS(
    SUMMARIZE(
      'Table 3',
      [Group],
      [Attribute],
      "__Measure",[Measure]
    ),
    "__IncludeInTotals",SEARCH("%",[Attribute],,-1)
  )
RETURN
  IF(
    HASONEVALUE('Table 3'[Attribute]),
    [Measure],
    SUMX(FILTER(__Table,[__IncludeInTotals] = -1),[__Measure])
  )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

13 REPLIES 13
amitchandak
Super User
Super User

@Fragan, creo que necesita subtotal. Usted debe tratar de echar un vistazo a esto :

https://community.powerbi.com/t5/Desktop/Percentage-of-subtotal/td-p/95390

Allexcept te dará eso

@amitchandak

No creo que necesite subtotales, sólo quiero hacer Attribute5 el subtotal y no calcular el subtotal de nuevo. en otras palabras quiero excluir muy cosa del subtotal y total además de Attribute5

Va a depender de cómo se está subtotaling, pero:

Measure = 
IF(
HASONEVALUE('Table 3'[Group]),
SUMX (
    DISTINCT ( 'Table 3'[Attributes] ),
    SWITCH (
        'Table 3'[Attributes],
        "Attribute5", CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Attributes] = "Attribute1" )
            - CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Attributes] = "Attribute2" )
            - CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Attributes] = "Attribute3" ),
            var a = 'Table 3'[Attributes] return
        CALCULATE ( SUM ( 'Table'[Value] ),'Table'[Attributes]=a)
    )
),
"Attribute5"
)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

¿Puedo hacer lo mismo para el total de columnas globales?image.png

Como en lugar de tener "Attribute5" allí me gustaría tener 1142 (que es 239 + 903)

Sí, eso es más a lo largo de las líneas de Esto parece un problema de totales de medida. Muy común. Vea mi post al respecto aquí: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Además, esta medida rápida, medida totales, la palabra final debe obtener lo que necesita:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

Por lo que entiendo, su publicación es filtrar el total en algún valor, pero no excluyendo un valor de fila de totales, ¿puede pelase comprobar OP i editado OP con más detalles

OK, lo que no entiendo es esta parte"y cada atributo que contiene % en el futuro". ¿Está diciendo que en el futuro puede tener otros atributos que tienen un símbolo de porcentaje en ellos y desea que se excluyan?

Mientras tanto, es posible que desee echar un vistazo a MM3TR, fue diseñado para escenarios más complejos que solo los totales generales no son correctos, pero el concepto es el mismo, crea una variable de tabla que hace un resumen o grupo exactamente de la manera en que lo tiene dispuesto en su visual, en su caso, a continuación, filtrar cualquier cosa que SEARCH para % volvió verdadero o no en blanco , etc. y luego se agregaría sobre esa tabla usando algo como SUMX.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Matrix-Measure-Total-Triple-Threat-Rock-amp-...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

sí quiero excluir cada atributo que tiene % en su nombre del total

Estoy comprobando el enlace que acaba de enviar rn

OK, echando un vistazo al post original, tal vez algo como:

Measure 2 =
VAR __Table =
  ADDCOLUMNS(
    SUMMARIZE(
      'Table 3',
      [Group],
      [Attribute],
      "__Measure",[Measure]
    ),
    "__IncludeInTotals",SEARCH("%",[Attribute],,-1)
  )
RETURN
  IF(
    HASONEVALUE('Table 3'[Attribute]),
    [Measure],
    SUMX(FILTER(__Table,[__IncludeInTotals] = -1),[__Measure])
  )

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Amigo, eres fuego directo lmao. Funciona, voy a leer los documentos con el fin de entender cómo funciona esto.

Gracias de nuevo

Greg_Deckler
Super User
Super User

Echa un vistazo a MM3TR: https://community.powerbi.com/t5/Quick-Measures-Gallery/Matrix-Measure-Total-Triple-Threat-Rock-amp-...

Además, esta medida rápida, medida totales, la palabra final debe obtener lo que necesita:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler debo incluir esto a mi mesure o hacer uno nuevo ??

Personalmente generalmente hago una segunda medida. Ayuda con la solución de problemas.

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors