Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Tengo dos medidas, una que calcula el peso de las ventas por partida (%Peso) y otra que calcula el precio unitario ($Precio Unitario)
Necesito encontrar una medida que me asigne para cada articulo un precio unitario, el precio unitario que necesito tiene que ser el que tenga el mayor % peso por partida.
Mi base de datos es la parte azul, mis medidas es la parte verde y las medidas que necesito es la parte café.
Espero puedan ayudarme.
Muchas gracias!
Saludos 🙂
Solved! Go to Solution.
Hi @Lucy_Ramirez ,
Since it's not clear how your ($Precio Unitario) measure is created, I used a column instead.
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
1.Create three measures
%Peso =
VAR _SUM = CALCULATE(
SUM('Table'[Ventas]),
ALLEXCEPT('Table','Table'[Partida])
)
VAR _value =
sum('Table'[Ventas])
RETURN _value/_SUM
Mayor %Precio por paratida = var _a=[%Peso]
VAR _table =
SUMMARIZE(
ALLEXCEPT('Table',
'Table'[Partida]),
"%peso",_a)
RETURN
MAXX( ALLEXCEPT('Table',
'Table'[Partida]),[%peso])
Precio Unitario de Mayor% Peso por partida =
CALCULATE(
MAX('Table'[$Precio Unitario]),
FILTER(ALLEXCEPT('Table',
'Table'[Partida]),
'Table'[%Peso] = 'Table'[Mayor %Precio por paratida]
)
)
2.Final output
If this is not the outcome you were hoping for. Please provide detailed sample data and ($Precio Unitario) measure-creating processes So that I can help you better.
Best Regards,
Albert He
Hi @Lucy_Ramirez ,
Since it's not clear how your ($Precio Unitario) measure is created, I used a column instead.
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
1.Create three measures
%Peso =
VAR _SUM = CALCULATE(
SUM('Table'[Ventas]),
ALLEXCEPT('Table','Table'[Partida])
)
VAR _value =
sum('Table'[Ventas])
RETURN _value/_SUM
Mayor %Precio por paratida = var _a=[%Peso]
VAR _table =
SUMMARIZE(
ALLEXCEPT('Table',
'Table'[Partida]),
"%peso",_a)
RETURN
MAXX( ALLEXCEPT('Table',
'Table'[Partida]),[%peso])
Precio Unitario de Mayor% Peso por partida =
CALCULATE(
MAX('Table'[$Precio Unitario]),
FILTER(ALLEXCEPT('Table',
'Table'[Partida]),
'Table'[%Peso] = 'Table'[Mayor %Precio por paratida]
)
)
2.Final output
If this is not the outcome you were hoping for. Please provide detailed sample data and ($Precio Unitario) measure-creating processes So that I can help you better.
Best Regards,
Albert He
@Lucy_Ramirez , Try measure like
calculate([%peso], filter(allselected(Table), Table[partida] = max(Table[partida])))