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

Devolver la categoría más grande en función de una suma

Hola

Estoy buscando una (esperemos) medida DAX simple para resolver el siguiente problema.

Tengo una gama compuesta por un número de empleados, un producto elegido y sus ahorros en cada producto. En una tabla diferente, necesito crear una medida que devuelva el nombre del producto que contiene la mayor suma combinada de ahorros. Por ejemplo, la Persona 1, esto sería "Producto B", porque los 750.000 en el Producto B superan los 500.000 del Producto A (si hubiera sido contrario, la medida debería devolver el "Producto A").

Sample.png

Estoy trabajando en PowerPivot en Excel 2013 y anteriormente he confiado en "FIRSTNONBLANK" ya que los rangos no han contenido valores de dulicado. Sin embargo, esa solución ya no es suficiente. Cualquier ayuda es muy apreciada.

¡Gracias!

3 ACCEPTED SOLUTIONS

Hola @Phil123456789,

Excel y power bi utilizan lógica y estructura diferentes para almacenar tablas de datos.

Tal vez pueda intentar convertir la tabla en la tabla de consulta y usar la 'consulta M' para crear una consulta de referencia para resumir los registros de tabla sin procesar.

let
    Source = RawTable,//change to your query table name
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Product", type text}, {"Amount", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Name", "Product"}, {{"Total", each List.Sum([Amount]), type nullable number}}),
    #"Grouped Rows1" = Table.Group(#"Grouped Rows", {"Name"}, {{"Count", each Table.LastN(_, 1), type table}}),
    #"Expanded Count" = Table.ExpandTableColumn(#"Grouped Rows1", "Count", {"Product", "Total"}, {"Product", "Total"})
in
    #"Expanded Count"

1.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

Ashish_Mathur
Super User
Super User

Hola

Estas medidas funcionan

Importe total: SUM(Datos[Cantidad])

Producto superior: FIRSTNONBLANK ( TOPN ( 1, VALUES ( Data[Product] ), [Importe total] ), 1 )

Espero que esto ayude.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hola

Puede descargar mi archivo PBI desde aquí.

Espero que esto ayude.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

16 REPLIES 16

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.

Top Kudoed Authors