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.
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])))
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 |
---|---|
106 | |
104 | |
77 | |
68 | |
61 |
User | Count |
---|---|
148 | |
107 | |
107 | |
83 | |
70 |