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 a todos
Necesito ayuda con un problema de Actualización + Pronóstico
Tenemos previsiones actualizadas trimestralmente, por lo que en marzo planificamos para el período de abril a diciembre. Necesito calcular un pronóstico de año completo agregando los reales para los meses anteriores. Básicamente, necesito la columna Pronóstico FY:
He intentado
IF(ISBLANK([Pronóstico]),[Real],[Pronóstico])
pero a medida que pasa el tiempo y tengo datos reales, encontré el siguiente problema:
Solved! Go to Solution.
hola @paliman,
Puede utilizar las siguientes fórmulas de medida para obtener el total reemplazado en función del cliente o grupo de productos:
FY Customer =
VAR merge =
ADDCOLUMNS (
UNION (
ADDCOLUMNS ( Actuals, "Source", "Actuals" ),
ADDCOLUMNS ( Foreast, "Source", "Foreast" )
),
"Month", LOOKUPVALUE ( 'Calendar'[Month], 'Calendar'[Date], [Date] )
)
VAR summary =
SUMMARIZE (
merge,
[Month],
[Customer],
"FY",
VAR _fs =
SUMX (
FILTER (
merge,
[Month] = EARLIER ( [Month] )
&& [Customer] = EARLIER ( [Customer] )
&& [Source] = "Foreast"
),
[Sales]
)
VAR _as =
SUMX (
FILTER (
merge,
[Month] = EARLIER ( [Month] )
&& [Customer] = EARLIER ( [Customer] )
&& [Source] = "Actuals"
),
[Sales]
)
RETURN
IF ( _fs = BLANK (), _as, _fs )
)
RETURN
IF (
ISINSCOPE ( Customers[Customer Name] ),
IF ( ISBLANK ( [Forecast Sales] ), [Actual Sales], [Forecast Sales] ),
SUMX ( summary, [FY] )
)
FY Product =
VAR merge =
ADDCOLUMNS (
UNION (
ADDCOLUMNS ( Actuals, "Source", "Actuals" ),
ADDCOLUMNS ( Foreast, "Source", "Foreast" )
),
"Month", LOOKUPVALUE ( 'Calendar'[Month], 'Calendar'[Date], [Date] )
)
VAR summary =
SUMMARIZE (
merge,
[Month],
[Product],
"FY",
VAR _fs =
SUMX (
FILTER (
merge,
[Month] = EARLIER ( [Month] )
&& [Product] = EARLIER ( [Product] )
&& [Source] = "Foreast"
),
[Sales]
)
VAR _as =
SUMX (
FILTER (
merge,
[Month] = EARLIER ( [Month] )
&& [Product] = EARLIER ( [Product] )
&& [Source] = "Actuals"
),
[Sales]
)
RETURN
IF ( _fs = BLANK (), _as, _fs )
)
RETURN
IF (
ISINSCOPE ('Products'[Product description]),
IF ( ISBLANK ( [Forecast Sales] ), [Actual Sales], [Forecast Sales] ),
SUMX ( summary, [FY] )
)
saludos
Xiaoxin Sheng
Algo salió mal y esta foto no fue publicada, Lo que necesito es el FY Fcst Col. a continuación:
Hola @paliman,
Puesto que no tengo tanta claridad para su estructura de datos de tabla, ¿puede compartir algunos datos ficticios para probar?
Cómo obtener respuestas a su pregunta rápidamente
Además, puede echar un vistazo al siguiente blog para saber cómo controlar los valores en blanco y usarlo con instrucciones if:
Manejo de BLANK en DAX
saludos
Xiaoxin Sheng
Ok, lo siento por el desorden, voy a tratar de explicarlo mejor.
Tengo dos tablas: Reales y Pronósticos; El pronóstico se actualiza trimestralmente.
Quiero calcular el pronóstico del año completo de la siguiente manera:
Para el pronóstico del segundo trimestre, que contiene datos para el período de abril a diciembre, Pronóstico del año viáticos - Reales Ene-Mar + Fcst Apr-Dec
He probado el enfoque muy simple de IF(ISBLANK([Forecast]),[Actuals],[Forecast]), pero mi problema es que si no se pronosticó un producto o cliente en particular, el resultado será el valor real en lugar de un cero o un espacio en blanco. Por favor, vea la captura de pantalla a continuación. También he publicado un enlace a mi Google Drive con el modelo que utilicé para este ejemplo.
Muchas gracias de antemano
https://drive.google.com/file/d/1nasnWLt8eqmIgko9TimuOeLDPIcnUNDM/view?usp=sharing
hola @paliman,
Puede utilizar las siguientes fórmulas de medida para obtener el total reemplazado en función del cliente o grupo de productos:
FY Customer =
VAR merge =
ADDCOLUMNS (
UNION (
ADDCOLUMNS ( Actuals, "Source", "Actuals" ),
ADDCOLUMNS ( Foreast, "Source", "Foreast" )
),
"Month", LOOKUPVALUE ( 'Calendar'[Month], 'Calendar'[Date], [Date] )
)
VAR summary =
SUMMARIZE (
merge,
[Month],
[Customer],
"FY",
VAR _fs =
SUMX (
FILTER (
merge,
[Month] = EARLIER ( [Month] )
&& [Customer] = EARLIER ( [Customer] )
&& [Source] = "Foreast"
),
[Sales]
)
VAR _as =
SUMX (
FILTER (
merge,
[Month] = EARLIER ( [Month] )
&& [Customer] = EARLIER ( [Customer] )
&& [Source] = "Actuals"
),
[Sales]
)
RETURN
IF ( _fs = BLANK (), _as, _fs )
)
RETURN
IF (
ISINSCOPE ( Customers[Customer Name] ),
IF ( ISBLANK ( [Forecast Sales] ), [Actual Sales], [Forecast Sales] ),
SUMX ( summary, [FY] )
)
FY Product =
VAR merge =
ADDCOLUMNS (
UNION (
ADDCOLUMNS ( Actuals, "Source", "Actuals" ),
ADDCOLUMNS ( Foreast, "Source", "Foreast" )
),
"Month", LOOKUPVALUE ( 'Calendar'[Month], 'Calendar'[Date], [Date] )
)
VAR summary =
SUMMARIZE (
merge,
[Month],
[Product],
"FY",
VAR _fs =
SUMX (
FILTER (
merge,
[Month] = EARLIER ( [Month] )
&& [Product] = EARLIER ( [Product] )
&& [Source] = "Foreast"
),
[Sales]
)
VAR _as =
SUMX (
FILTER (
merge,
[Month] = EARLIER ( [Month] )
&& [Product] = EARLIER ( [Product] )
&& [Source] = "Actuals"
),
[Sales]
)
RETURN
IF ( _fs = BLANK (), _as, _fs )
)
RETURN
IF (
ISINSCOPE ('Products'[Product description]),
IF ( ISBLANK ( [Forecast Sales] ), [Actual Sales], [Forecast Sales] ),
SUMX ( summary, [FY] )
)
saludos
Xiaoxin Sheng
@paliman Lo sentimos, puede explicar más detalles sobre su problema. ¿Cómo son los datos del modelo de datos? Las dos capturas de pantalla están en formatos muy diferentes, por lo que la que está trabajando en Power BI, entonces podemos usarla para ayudarle a obtener el resultado que desea.
No entiendo cuál es el problema resaltado en rojo- hace exactamente lo que ha pedido en la fórmula, así que por favor explique más lo que está tratando de hacer para que podamos ayudar más.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
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 |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |