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.
Hola, tengo un cálculo realmente complicado para mí que no puedo resolver. Tengo una tabla salarial donde están todos los salarios de los empleados. Necesito calcular cuánto ha aumentado el salario. Puede haber múltiples aumentos salariales / empleado y debe calcularse a partir de los dos últimos acuerdos.
Por ejemplo, Employee.Id 1: Calcular(suma(salario mensual1-salario mensual2) donde employee.id = 1 y salario mensual1=último salario y salario mensual2 =segundo salario más alto.
Identificación | Employee.Id | Fecha de inicio | MensualWage |
1 | 1 | 01.01.2018 | 1000 |
2 | 2 | 10.01.2019 | 3000 |
3 | 1 | 01.01.2019 | 1500 |
4 | 2 | 05.11.2020 | 3200 |
5 | 1 | 01.01.2021 | 2000 |
6 | 3 | 28.10.2020 | 1500 |
7 | 3 | 01.09.2021 | 1600 |
Solved! Go to Solution.
Hay @vuolleh,
Puede crear dos columnas calculadas
rank =
RANKX (
FILTER ( 'Table', [Employee.Id] = EARLIER ( 'Table'[Employee.Id] ) ),
[Startdate],
,
ASC,
DENSE
)
increase amount =
VAR _amount =
CALCULATE (
SUM ( 'Table'[MonthlyWage] ),
FILTER (
'Table',
[Employee.Id] = EARLIER ( 'Table'[Employee.Id] )
&& [rank]
= EARLIER ( 'Table'[rank] ) - 1
)
)
RETURN
IF ( ISBLANK ( _amount ), 0, [MonthlyWage] - _amount )
Saludos
Esteban Tao
Si esta publicación ayuda,entonces considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.
Hay @vuolleh,
Puede crear dos columnas calculadas
rank =
RANKX (
FILTER ( 'Table', [Employee.Id] = EARLIER ( 'Table'[Employee.Id] ) ),
[Startdate],
,
ASC,
DENSE
)
increase amount =
VAR _amount =
CALCULATE (
SUM ( 'Table'[MonthlyWage] ),
FILTER (
'Table',
[Employee.Id] = EARLIER ( 'Table'[Employee.Id] )
&& [rank]
= EARLIER ( 'Table'[rank] ) - 1
)
)
RETURN
IF ( ISBLANK ( _amount ), 0, [MonthlyWage] - _amount )
Saludos
Esteban Tao
Si esta publicación ayuda,entonces considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.
Hola
Genial esto funciona como un encanto :)! ¡Muchas gracias!
@vuolleh ,
Meausre =
var _max = calculate(Max(Table[Startdate]), allexcept(Table, Table[Employee.ID]))
var _max2 = calculate(MaxX(Filter(Table, Table[Startdate]<_max),Table[Startdate] ), allexcept(Table, Table[Employee.ID]))
devolución
calculate(sumX(values(Table[employee.id]) , calculate(sum(Table[MonthlyWage]), filter(Table, Table[Startdate]=_max)) -calculate(sum(Table[MonthlyWage]), filter(Table, Table[Startdate]=_max1))))
Hola, @amitchandak por alguna razón el cálculo devuelve un resultado incorrecto. por ejemplo, el salario anterior ha sido de 1337 y el nuevo salario es de 3000. El resultado debe ser 1663 (la diferencia entre el salario actual y el anterior) pero el cálculo devuelve -1337
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
1 | |
1 |