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
RB_G
New Member

Calcular producto de suma dentro de una jerarquía

Tengo una tabla con una jerarquía, por nivel de jerarquía hay un factor de suma que se aplica a toda la jerarquía subyacente.

Quiero calcular una columna con el coste total, que tiene en cuenta las cantidades de una fila y las filas subyacentes en la jerarquía.

A continuación un ejemplo de la tabla, incluida la columna con los valores calculados deseados (azul) y una representación visual de de calculation (rojo)

Gracias

IdParent_IDCantidadCantidadCalcular
Cálculo visual
1 1 100 euros(2 * ((3 * (( 2 * 5 ) + ( 1 * 3 ))) + ( 1 * 4 ))) + (2 * 7)
212 86 euros2 * ((3 * (( 2 * 5 ) + ( 1 * 3 ))) + ( 1 * 4 ))
3127 euros14 euros2 * 7
4214 euros4 euros1 * 4
523 39 euros3 * (( 2 * 5 ) + ( 1 * 3 ))
6525 euros10 euros2 * 5
7513 euros3 euros1 * 3
1 REPLY 1
AllisonKennedy
Super User
Super User

Creo que un SUMX(Tabla, tabla[cantidad]*tabla[Importe])
debería acercarte.

¿Cómo son los datos sin procesar? ¿Tiene una tabla de dimensiones para los padres? Esto podría ayudar, ya que entonces puede ser capaz de estructurar el objeto visual de matriz de tal manera que este cálculo se realizará implícitamente sin ningún DAX necesario.

Please @mention me in your reply if you want a response.

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

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.