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
Agradecería ayuda con la asignación de una fórmula DAX.
Tengo un lookupvalue que verifica la moneda de cada día, aquí está la fórmula:
ExchangeRateUSD = IF(ISBLANK(LOOKUPVALUE(
'All currencyExchangeRates'[relationalExchangeRateAmount],
'All currencyExchangeRates'[StartingDateFormatted], Opportunities[ExchangeRateDate],
'All currencyExchangeRates'[currencyCode], Opportunities[CurrencyFormat_USD])),
LOOKUPVALUE(
'All currencyExchangeRates'[relationalExchangeRateAmount],
'All currencyExchangeRates'[StartingDateFormatted], DATE(Opportunities[ExchangeRateDate].[Year], Opportunities[ExchangeRateDate].[MonthNo], Opportunities[ExchangeRateDate].[Day]) - 3,
'All currencyExchangeRates'[currencyCode], Opportunities[CurrencyFormat_USD]),
LOOKUPVALUE(
'All currencyExchangeRates'[relationalExchangeRateAmount],
'All currencyExchangeRates'[StartingDateFormatted], Opportunities[ExchangeRateDate],
'All currencyExchangeRates'[currencyCode], Opportunities[CurrencyFormat_USD]))
Aquí hay un resumen de lo que hace:
¿Hay alguna forma de corregir para hacer una búsqueda de modo que busque un valor dentro de los 3 días anteriores, y si hay datos quizás un día antes, elija ese día en lugar de 3? Un ejemplo sería:
Si nos faltan datos, por ejemplo, el 15 de enero, y los datos del 14 de enero y el 12 de enero, ¿me gustaría que tomara datos del 14 en su lugar?
Gracias
Hola @al427 ,
Puede utilizar la función función con un que busca la fecha más cercana dentro de un rango de fechas.
A continuación se muestra que el DAX podría funcionar para usted:
ExchangeRateUSD = IF(ISBLANK(LOOKUPVALUE(
'All currencyExchangeRates'[relationalExchangeRateAmount],
'All currencyExchangeRates'[StartingDateFormatted], Opportunities[ExchangeRateDate],
'All currencyExchangeRates'[currencyCode], Opportunities[CurrencyFormat_USD])),
LOOKUPVALUE(
'All currencyExchangeRates'[relationalExchangeRateAmount],
'All currencyExchangeRates'[StartingDateFormatted],
MAXX(
FILTER(
'All currencyExchangeRates',
'All currencyExchangeRates'[currencyCode] = Opportunities[CurrencyFormat_USD] &&
'All currencyExchangeRates'[StartingDateFormatted] >= DATE(Opportunities[ExchangeRateDate].[Year], Opportunities[ExchangeRateDate].[MonthNo], Opportunities[ExchangeRateDate].[Day]) - 3 &&
'All currencyExchangeRates'[StartingDateFormatted] <= Opportunities[ExchangeRateDate]
),
'All currencyExchangeRates'[StartingDateFormatted]
),
'All currencyExchangeRates'[currencyCode], Opportunities[CurrencyFormat_USD]),
LOOKUPVALUE(
'All currencyExchangeRates'[relationalExchangeRateAmount],
'All currencyExchangeRates'[StartingDateFormatted], Opportunities[ExchangeRateDate],
'All currencyExchangeRates'[currencyCode], Opportunities[CurrencyFormat_USD]))
Esta fórmula modificada utiliza el método para encontrar la fecha más cercana dentro de un rango de fechas. El busca todas las fechas dentro de los 3 días anteriores a la fecha del tipo de cambio y la fecha del tipo de cambio en sí.
Saludos
Xianda Tang
Si esta publicación ayuda, considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
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 |