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

cálculo a partir de filas y columnas específicas

Estimado equipo,

Por favor, ayúdame con este escenario problemático

Parámetro Objetivo real

A 15 12

B 18 14

C 10 11

D 15 16

Tenga en cuenta que se trata de un dato ficticio, el conjunto de datos real puede tener más de 100 filas de este tipo

Fórmula (Suma del valor objetivo B y C)/(Suma del valor real A y D),

( 18+10)/(12+16) á 1

Nota:la salida de la fórmula debe mostrarse en una tarjeta.

¡Gracias!

3 REPLIES 3
v-eachen-msft
Community Support
Community Support

Hola @Shubham294_ ,

Puede despoducar las columnas "Target" y "Actual" en el editor de consultas.

1-1.PNG

A continuación, utilice filter para obtener el resultado.

Measure =
VAR a =
    SUMX (
        FILTER (
            'Table',
            'Table'[Parameter] IN { "B", "C" }
                && 'Table'[Attribute] = "Target"
        ),
        'Table'[Value]
    )
VAR b =
    SUMX (
        FILTER (
            'Table',
            'Table'[Parameter] IN { "A", "D" }
                && 'Table'[Attribute] = "Actual"
        ),
        'Table'[Value]
    )
RETURN
    DIVIDE ( a, b )

Aquí está mi archivo de prueba para su referencia.

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Ashish_Mathur
Super User
Super User

Hola

Esta medida funciona

Measure = CALCULATE(SUM(Data[Target]),Data[Parameter]="B"||Data[Parameter]="C")/CALCULATE(SUM(Data[Target]),Data[Parameter]="A"||Data[Parameter]="D")

Espero que esto ayude.

Untitled.png


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

Esto funcionará, devolviendo 1 en una tarjeta.

Measure = 
VAR varNumerator = 
SUMX(
    FILTER(
        'Table',
        'Table'[Parameter ] = "B" || 'Table'[Parameter ] = "C"
    ),
    'Table'[Target         ]
)
VAR varDenomenator = 
SUMX(
    FILTER(
        'Table',
        'Table'[Parameter ] = "A" || 'Table'[Parameter ] = "D"
    ),
    'Table'[Actual ]
)
VAR Result = 
    DIVIDE(
        varNumerator,
        varDenomenator,
        0
    )
RETURN
    Result

Nota: Los nombres de campo tienen un montón de espacios. No me di cuenta de que hasta que estaba bien en hacer la medida y no iba a volver y corregir los datos de origen. Si necesita más ayuda, consulte los enlaces a continuación para proporcionar datos.

Si esto funciona para usted, por favor márquelo la solución.
Cómo obtener una buena ayuda rápidamente. Ayúdanos a ayudarte.
Cómo obtener respuestas a su pregunta rápidamente
Cómo proporcionar datos de ejemplo en el foro de Power BI



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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.