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
Anonymous
Not applicable

Obtener la suma de un grupo de valores y mostrar el valor máximo

Hola

He estado experimentando con la construcción de un panel electoral de EE.UU., pero estoy luchando con los siguientes datos. Este es un ejemplo.

data.PNG

Lo que me gustaría hacer es insertar una columna después de eso simplemente indica "REP" o "DEM" basado en quién tiene más votos. La dificultad para mí es el DAX necesario para primero:
- Sumar el total de votos en cada estado para cada partido
- Comparar ambos valores y mostrar el mayor

Cualquier ayuda sería apreciada

actualizar:

Se las arregló para llegar a la mitad de allí, sumando los totales para cada estado (ver más abajo)

data2.PNG

Sum of State = CALCULATE(SUM(president_county_candidate[votes]), ALLEXCEPT(president_county_candidate,president_county_candidate[state],president_county_candidate[party]))

Ahora estoy atascado en cómo mostrar REP o DEM basado en qué valor es mayor

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @kashmachine,

Puede utilizar la siguiente fórmula de tabla calculada para generar registros más grandes a partir de registros de tabla agregados:

Summary table =
VAR summary =
    SUMMARIZE ( Table, [state], [party], "t_votes", SUM ( Table[votes] ) )
RETURN
    FILTER (
        summary,
        [t_votes]
            = MAXX ( FILTER ( summary, [state] = EARLIER ( [state] ) ), [t_votes] )
    )

15.png

saludos

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

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @kashmachine,

Puede utilizar la siguiente fórmula de tabla calculada para generar registros más grandes a partir de registros de tabla agregados:

Summary table =
VAR summary =
    SUMMARIZE ( Table, [state], [party], "t_votes", SUM ( Table[votes] ) )
RETURN
    FILTER (
        summary,
        [t_votes]
            = MAXX ( FILTER ( summary, [state] = EARLIER ( [state] ) ), [t_votes] )
    )

15.png

saludos

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.