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

Suma de devolución basada en la entrada de fila

Mi conjunto de datos tiene el siguiente aspecto:

ArtículoSegmentoVentas totales
SandíaCaro100
FresaCaro200
PlátanoBarato300
NaranjaBarato200

Me gustaría crear una medida que calcule las ventas totales para ese segmento en función del artículo que elija. Aquí está el resultado deseado:

ArtículoTotal del segmento
Sandía300
Fresa300
Plátano500
Naranja500

¿Cómo hago esto? Básicamente necesito un SUM(...) , ALLEXCEPT(... Segment..), pero necesito encontrar el segmento correcto basado en el artículo (por ejemplo, Sandía es "Caro" pero El plátano es "Cheap").

¡Gracias!

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@hi_potato_salad

Una variable puede leer el segmento y podemos usarlo en la medida.

Segement Total = 
VAR _Segment = SELECTEDVALUE('Table'[Segment])
RETURN
CALCULATE(
    SUM('Table'[Total sales]),
    ALLEXCEPT('Table','Table'[Segment]),
    'Table'[Segment] = _Segment
)

jdbuchanan71_0-1601580158762.png

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@hi_potato_salad

Una variable puede leer el segmento y podemos usarlo en la medida.

Segement Total = 
VAR _Segment = SELECTEDVALUE('Table'[Segment])
RETURN
CALCULATE(
    SUM('Table'[Total sales]),
    ALLEXCEPT('Table','Table'[Segment]),
    'Table'[Segment] = _Segment
)

jdbuchanan71_0-1601580158762.png

Anonymous
Not applicable

¡Muchas gracias! Esto es increíble.

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.