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
jcastr02
Post Prodigy
Post Prodigy

Suma de valores en la misma tabla pero con filtros

count.pngTengo una tabla con una columna count (valor) y una columna de tipo count (ya sea Headcount o Terms).

¿Cómo puedo obtener una medida para dividir la suma de la cuenta de personal / suma de términos

13 REPLIES 13
Greg_Deckler
Super User
Super User

@jcastr02 - Entonces, debería ser algo como:

Measure =
  DIVIDE(
    SUMX(FILTER(ALL('Table'),[Type]="Headcount"),[Count]),
    SUMX(FILTER(ALL('Table'),[Type]="Terms"),[Count]),
    0
  )

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

disculpas @Greg_Deckler significa decir suma de términos / promedio del número de cabezas - volteó alrededor.

Traté de hacer AverageX en su lugar, pero no funcionó...

@jcastr02 - No estoy seguro de por qué esto no funcionaría

Measure =
  DIVIDE(
    SUMX(FILTER(ALL('Table'),[Type]="Terms"),[Count]),
    AVERAGEX(FILTER(ALL('Table'),[Type]="Headcount"),[Count]),
    0
  )

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler   Hello,  It seems that the measure stays static, so when I click on example 9/1/2019 I should see % being    252/3798 = 6.63%, but no matter what date I click on, the number stays the same for the measure created.count12345.png

@jcastr02 - Use ALLSELECTED en lugar de ALL


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Todavía parece hacer un cálculo incorrecto - como ejemplo para 11/1/2019 & 12/1/2019.......

Suma de los Términos 309+265-574

Promedio de número de cabezas 7,511 / 2 x 3.755,5

Desgaste 574 / 3.755,5 a 15,28%

55.png

@Greg_Deckler ¿Alguna idea de cómo puedo lograr esto? Le agradezco su ayuda.

@jcastr02 - Publicar datos de muestra como texto y salida esperada y voy a echar un vistazo

No es realmente suficiente información para seguir adelante, por favor primero compruebe si su problema es un problema común enumerado aquí: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Además, consulte este post sobre cómo obtener respuesta a su pregunta rápidamente: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

Las partes más importantes son:
1. Datos de muestra como texto, utilice la herramienta de tabla en la barra de edición
2. Salida esperada de los datos de muestra
3. Explicación en palabras de cómo obtener de 1. a 2.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hola @Greg_Deckler Gracias por su ayuda - He añadido algunos datos de muestra en la caja roja en la imagen

dexler.png

Hola @Greg_Deckler he añadido algunos datos de muestra arriba, ¿alguna suerte con ese? Muchas gracias y agradezco la ayuda.

Hola @jcastr02 ,

Por favor, intente esto:

Measure =
VAR terms =
    CALCULATE ( SUM ( 'Table'[Count] ), 'Table'[Count Type] = "Terms" )
VAR Headcount =
    AVERAGEX (
        ALL ( 'Table'[File_date1] ),
        CALCULATE ( SUM ( 'Table'[Count] ), 'Table'[Count Type] = "Headcount" )
    )
RETURN
    DIVIDE ( terms, Headcount )

v-xuding-msft_0-1599635120736.png

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Muchas gracias @v-xuding-msft Parece que estoy cerca - cuando hago mi medida obtengo 12.71%, pero debería ser 12.55% - ¿Eres capaz de comprobarme dos veces? Gracias de nuevo por la ayuda..

count.count.png

@v-xuding-msft cualquier ayuda sería apreciada en arriba.. gracias de antemano

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.