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

Sumar cuando la versión es más alta por otra variable (sin versión máxima en todos los datos)

Hola, estoy luchando teniendo esta medida para trabajar.

Me gustaría tener una medida que sumará el valor sólo para la versión máxima para cada casa.

Así que a continuación de esta tabla de ejemplo:

House_IdVersion_IdValor
111000
122000
213000
315000

El resultado de esta medida debe ser: 10.000 porque se omite la house_id 1 versión 1, ya que hay otra versión más alta.

En House_id el resultado debe ser:

House_IdValor
12000
23000
35000

¿Alguien puede ayudarme?

¡Gracias!

16 REPLIES 16
Vera_33
Resident Rockstar
Resident Rockstar

Hola @janscas , ¿puedes probarlo? Reemplace table1 por su propio nombre de tabla.

Medida ?
VAR T1 - GROUPBY(Table1,Table1[House_Id],"MaxV",MAXX(CURRENTGROUP(),[Version_Id]))
devolución
CALCULATE(SUM('Table1'[Value]),TREATAS(T1,'Table1'[House_Id],Table1[Version_Id]))
HotChilli
Super User
Super User

Algo como esta medida:

MSum = VAR _maxVer = CALCULATE(MAX(TableR[Version_Id]), ALLEXCEPT(TableR, TableR[House_Id]))
RETURN
    CALCULATE(SUM(TableR[Value]), TableR[Version_Id] = _maxVer)

Pruebe con un conjunto de datos de muestra más grande

Anonymous
Not applicable

No,

Esto regresaría sólo 2000

@janscas , Crear una medida como esta y anuncio

Medida ?
VAR __id - MAX ( 'Tabla'[House_Id] )
VAR __Version_Id - CALCULATE ( MAX( 'Table'[Version_Id] ), ALLSELECTED ( 'Table' ), 'Table'[House_Id] - __id )
RETURN CALCULATE ( sum ( 'Table'[Value] ), VALUES ( 'Table'[House_Id ), 'Table'[House_Id] - __id, 'Table'[Version_Id] - __Version_Id )

Anonymous
Not applicable

@amitchandak Eso no funcionó

@Vera_33 Eso tampoco funcionó

Hola @janscas ,

Pruebe esta medida:

MaxValue ?
SUMX(ADDCOLUMNS(SUMMARIZE('Table'; 'Tabla'[House_Id]; "MaxValue"; MAX('Tabla'[Version_Id])); "Valor";
CALCULATE(SUM('Table'[Value]); FILTRO(ALL('Tabla'); 'Table'[House_Id] á EARLIER('Tabla'[House_Id]) && 'Tabla'[Version_Id] á [MaxValue]))); [Valor])
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Anonymous
Not applicable

No funcionó @camargos88

@janscas esto lo hará

Measure = 
SUMX ( 
    VALUES ( 'Table'[House_Id] ), 
    CALCULATE ( 
        MAX ( 'Table'[Value] ), 
        ALLEXCEPT ( 'Table', 'Table'[House_Id] ) 
    )
)

Me 💖 Kudos 🙂 si mi solución me ayudara.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k no, esta medida ni siquiera tiene en cuenta eht Version_Id

@janscas ah, me perdí eso, pensé que querías el valor más alto de la casa ignorando la versión, pero creo que estás buscando el valor de la versión más alta de la casa.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@janscas aquí es, añadir las dos medidas siguientes y la medida 2 hará el trabajo

Measure = 
CALCULATE ( 
    SUM ( 'Table'[Value] ),
    FILTER ( 
        ALLEXCEPT ( 'Table', 'Table'[House_Id] ), 
        'Table'[Version_Id] = MAX ( 'Table'[Version_Id]  )
    )
)


Measure 2 = SUMX ( VALUES ( 'Table'[House_Id] ), [Measure] )

Me 💖Kudos 🙂 si mi solución me ayudara.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k Esto no funciona también. La opinión es que la medida debe resumir por House_Id en el Max(Version_Id), a continuación, hacer un INNER JOIN con la tabla principal. A continuación, suma en esta tabla virtual.

Pero no sé cómo hacer esto con Dax.

@janscas Parece que no veo todos los detalles. Ver la solución adjunta y funciona, se puede tomar desde allí o proporcionar lo que me estoy perdiendo.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

ok @parry2k Funciona en su versión, pero en reallity tengo más variables, como Color_Id y más.

Por lo tanto, si quiero sumar por color_Id en lugar de House_Id No funciona.

Ver https://we.tl/t-GaIKGSNEDP

Anonymous
Not applicable

@parry2k Eso es correcto quiero sumar los valores de todas las casas, pero sólo donde el identificador de versión es el máximo en cada casa.

Hola @janscas ,

¿No es eso ?

Capture.PNG

Ricardo



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



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