Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Estoy tratando de crear una nueva medida con varias instrucciones if sin embargo estoy recibiendo un error. ¿Algún consejo?
Si ListingStatus á "Inactive" entonces calcular una expresión determinada usando Calculate(sumx( con filtros.
Si ListingStatus - "Active" entonces calcule el mismo express con filtros sumx ligeramente diferentes.
Aquí está la medida:
*************************************************
Tasa de pedido promedio (ponderado) :
SI (
Listado[ListingStatus] á "Inactivo",
DIVIDE (
CALCULAR (
SUMX ( 'Listing', Listing[NetAskRate] * Listing[ListingAvailableSF] ),
Listado[NetAskRate] > 0,
DATESINPERIOD (
ListingRemovalDate[ListingRemovalDate_DateOnly],
HOY (),
-12,
Mes
)
),
CALCULAR (
SUM ( [ListingAvailableSF] ),
Listado[NetAskRate] > 0,
DATESINPERIOD (
ListingRemovalDate[ListingRemovalDate_DateOnly],
HOY (),
-12,
Mes
)
)
),
SI (
Listado[ListingStatus] á "Activo",
DIVIDE (
CALCULAR (
SUMX ( 'Listing', Listing[NetAskRate] * Listing[ListingAvailableSF] ),
Listado[NetAskRate] > 0
),
CALCULATE ( SUM ( [ListingAvailableSF] ), Listado[NetAskRate] > 0 )
)
)
)
**************************************************
Aquí está la advertencia de error:
Advertencia 1 Medida 'Listado'[Tasa de pedido media (ponderada)] : El valor de la columna 'ListingStatus' en la tabla 'Listing' no se puede determinar en el contexto actual. Compruebe que existen todas las columnas a las que se hace referencia en la expresión de cálculo y que no hay dependencias circulares. Esto también puede ocurrir cuando la fórmula de una medida hace referencia directamente a una columna sin realizar ninguna agregación (como suma, promedio o recuento) en esa columna. La columna no tiene un solo valor; tiene muchos valores, uno para cada fila de la tabla y no se ha especificado ninguna fila. P:'MarketingTabularModel'MarketingTabularModel'Model.bim 0 0 MarketingTabularModel
Solved! Go to Solution.
Hola @bizintelguy604 ,
el primer argumento de la if-statement no es válido:
Tasa de pedido promedio (ponderado) :
SI (
Listado[ListingStatus] á "Inactivo",
esto hace referencia a una columna completa, pero necesita un único valor (escalar) en su lugar.
Esto podría lograrse mediante una función de agregación, como MIN o MAX:
Tasa de pedido promedio (ponderado) :
SI (
MAX ( Listing[ListingStatus] ) - "Inactivo",
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
@bizintelguy604 , Probar como
Avg Asking Rate (Weighted) :=
IF (
max(Listing[ListingStatus]) = "Inactive",
DIVIDE (
CALCULATE (
SUMX ( 'Listing', Listing[NetAskRate] * Listing[ListingAvailableSF] ),
Listing[NetAskRate] > 0,
DATESINPERIOD (
ListingRemovalDate[ListingRemovalDate_DateOnly],
TODAY (),
-12,
MONTH
)
),
CALCULATE (
SUM ( [ListingAvailableSF] ),
Listing[NetAskRate] > 0,
DATESINPERIOD (
ListingRemovalDate[ListingRemovalDate_DateOnly],
TODAY (),
-12,
MONTH
)
)
),
IF (
max(Listing[ListingStatus]) = "Active",
DIVIDE (
CALCULATE (
SUMX ( 'Listing', Listing[NetAskRate] * Listing[ListingAvailableSF] ),
Listing[NetAskRate] > 0
),
CALCULATE ( SUM ( [ListingAvailableSF] ), Listing[NetAskRate] > 0 )
)
)
)
Hola @amitchandak ,
preguntándose si usted vio otros defectos en la medida o acaba de escribir el código de medida completo con los cambios que sugerí?
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
@ImkeF, mi mala señorita. Gracias por apuntar.
Hola @bizintelguy604 ,
el primer argumento de la if-statement no es válido:
Tasa de pedido promedio (ponderado) :
SI (
Listado[ListingStatus] á "Inactivo",
esto hace referencia a una columna completa, pero necesita un único valor (escalar) en su lugar.
Esto podría lograrse mediante una función de agregación, como MIN o MAX:
Tasa de pedido promedio (ponderado) :
SI (
MAX ( Listing[ListingStatus] ) - "Inactivo",
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries