Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Syndicate_Admin
Administrator
Administrator

Obtener % entre las filas actual y anterior

Hola a todos

Tengo los datos a continuación y necesito obtener % diff para la fila actual y la fila anterior y también mostrar la primera fila como 0 si no hay una fila anterior.

Aquí mi columna de año está en el tipo de datos de cadena.

NaiduNaidu_0-1737343010572.png

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Hola @नईदुनाइडु ,

Ypu puede lograr tu objetivo siguiendo estos pasos:
1- Cree una nueva columna calculada para sortYear utilizando este DAX:

SortYear = VALUE(SUBSTITUTE('Table'[Year], "F", ""))

2- Ahora crea una nueva medida para % de diferencia entre este DAX:

% Diff = 
VAR CurrentSales = MAX('Table'[Sales])
VAR CurrentYear = MAX('Table'[SortYear])
VAR PreviousSales = 
    CALCULATE(
        MAX('Table'[Sales]),
        FILTER(
            ALL('Table'),
            'Table'[SortYear] = CurrentYear - 1
        )
    )
RETURN
IF(
    ISBLANK(PreviousSales),
    0,
    DIVIDE(CurrentSales - PreviousSales, PreviousSales)
)

3- Ahora arrastra y suelta la medida % Diff para tu Matriz, tu resultado se verá así:

Bibiano_Geraldo_0-1737367686058.png

Syndicate_Admin
Administrator
Administrator

Hola @NaiduNaidu
Puede utilizar la función Offset para obtener el resultado deseado:

Diferencia de ventas de la fila anterior %=
Var ventas_= suma('Mesa'[Ventas])
Var Prev = CALCULAR(suma('Mesa'[Ventas]), COMPENSAR(-1, TODOS SELECCIONADOS('Mesa'[Año]), ORDENAR ('Mesa'[Año], ASC)) )+0
DEVOLUCIÓN
DIVIDIR((ventas_-Prev),Prev)
Ritaf1983_0-1737365727417.png

El pbix está conectado

Si esta publicación ayuda, considere aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.