Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Lecram36
Regular Visitor

Cálculo variable línea por línea basado en el valor de la segunda tabla

Hola

Necesito ayuda aquí ... Intente calcular un "Impacto de moneda". Dada una tabla de "base" con, digamos, ventas en moneda local y un tipo de cambio; dada una tabla "fxrate" que se segmenta para filtrar a una referencia única, ¿cómo puedo calcular línea por línea y obtener el total? La fórmula debe ser eficiente, porque hay fácilmente 500'000 filas en "base". No es fácil de explicar el problema, así que hice un pequeño dibujo! Cualquier ayuda es muy apreciada ...

Capture.JPG

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

HOLA @Lecram36

En primer lugar, usted debe saber que:

1. La columna/tabla de cálculo no admite cambios dinámicos basados en filtro o segmentación de datos.
2. La medida puede verse afectada por el filtro / cortador, por lo que puede usarlo para obtener un resultado de resumen dinámico en un objeto visual.

https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/

En segundo lugar, para su caso, usted podría tratar de esta manera como se muestra a continuación:

Paso 1:

Cree una relación entre Datatable y la columna FXTable by Currency. (Esta relación será de muchos a muchos)

Step2:

A continuación, cree una medida como se indica a continuación:

Impact = 
SUMX('Data Table', CALCULATE(SUM('Data Table'[Sales])-SUM('Data Table'[Sales])*DIVIDE(SUM('Data Table'[FxRate]),SUM(FXTable[RefFxRate]))))

Resultado:

5.JPG

y aquí está el archivo pbix de muestra, por favor pruébelo.

saludos

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-lili6-msft
Community Support
Community Support

HOLA @Lecram36

En primer lugar, usted debe saber que:

1. La columna/tabla de cálculo no admite cambios dinámicos basados en filtro o segmentación de datos.
2. La medida puede verse afectada por el filtro / cortador, por lo que puede usarlo para obtener un resultado de resumen dinámico en un objeto visual.

https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/

En segundo lugar, para su caso, usted podría tratar de esta manera como se muestra a continuación:

Paso 1:

Cree una relación entre Datatable y la columna FXTable by Currency. (Esta relación será de muchos a muchos)

Step2:

A continuación, cree una medida como se indica a continuación:

Impact = 
SUMX('Data Table', CALCULATE(SUM('Data Table'[Sales])-SUM('Data Table'[Sales])*DIVIDE(SUM('Data Table'[FxRate]),SUM(FXTable[RefFxRate]))))

Resultado:

5.JPG

y aquí está el archivo pbix de muestra, por favor pruébelo.

saludos

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
parry2k
Super User
Super User

@Lecram36 En función de la tabla de datos, debe ser algo como esto, agregar como una columna

Sales Impact = 
Table[Sales] - ( DIVIDE ( ( Table[Sales] * Table[FxRate] ), Table[RefFxRate] ) )

Me gustaría elogiossi mi solución me ayudó.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para darle a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k No, desafortunadamente no es tan simple: Table[RefFxRate] no está disponible. Está en la hoja de Excel para la demostración del cálculo, pero es un valor externo calculado 'sobre la marcha'

@Lecram36

ok entonces usted tiene que compartir sus datos de la forma en que se ven y el diagrama de modelo / relación.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.