Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Good afternoon everyone,
To request your support, I am starting in Power BI, and I need to perform the calculation of the column: consumptionCalculated, this value is calculated:
1.- When the father does not have a value in the column: consumption and its value is dependent on the consumption of its children. For example:
consumoCalculado de PadreA = consumo Hijo1dePadreA + consumo Hijo2dePadreB
consumoCalculado de PadreA = 200 + 300
consumoCalculado de PadreA = 500
2.- When the parent or children have a value in the column: consumption,
consumoCalculado de PadreC = consumo
consumoCalculado de PadreC = 100
consumoCalculado de Hijo1dePadreB = consumo
consumoCalculado de Hijo1dePadreB = 100
La tabla de datos de ejemplo:
| clavePadre | clave | nombre | consumo | inventario | saldo | consumoCalculado |
| cve001 | PadreA | 1000 | 800 | 500 | ||
| cve004 | PadreB | 200 | ||||
| cve007 | PadreC | 100 | 600 | 500 | 100 | |
| cve001 | cve002 | Hijo1dePadreA | 200 | 200 | ||
| cve001 | cvd003 | Hijo2dePadreA | 300 | 300 | ||
| cve004 | cve005 | Hijo1dePadreB | 100 | 200 | 100 | 100 |
| cve004 | cve006 | Hijo2dePadreB | 100 | 300 | 200 | 100 |
In advance, I thank you for your valuable support.
Greetings, Cipriano.
Solved! Go to Solution.
Hi @Cipriano ,
Please try this code to create a calcualted column.
consumoCalculado =
VAR _Child =
SUMMARIZE (
FILTER (
'Table',
'Table'[nombre] <> EARLIER ( 'Table'[nombre] )
&& CONTAINSSTRING ( 'Table'[nombre], EARLIER ( 'Table'[nombre] ) )
),
[nombre]
)
VAR _SUMCHILD =
CALCULATE (
SUM ( 'Table'[consumo] ),
FILTER ( 'Table', 'Table'[nombre] IN _Child )
)
RETURN
IF ( 'Table'[consumo] <> BLANK (), 'Table'[consumo], _SUMCHILD )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Cipriano ,
Please try this code to create a calcualted column.
consumoCalculado =
VAR _Child =
SUMMARIZE (
FILTER (
'Table',
'Table'[nombre] <> EARLIER ( 'Table'[nombre] )
&& CONTAINSSTRING ( 'Table'[nombre], EARLIER ( 'Table'[nombre] ) )
),
[nombre]
)
VAR _SUMCHILD =
CALCULATE (
SUM ( 'Table'[consumo] ),
FILTER ( 'Table', 'Table'[nombre] IN _Child )
)
RETURN
IF ( 'Table'[consumo] <> BLANK (), 'Table'[consumo], _SUMCHILD )
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I really appreciate your support, regards.
Will you have situations in your data where PadreC does not have any child records?
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 45 | |
| 38 | |
| 34 | |
| 21 | |
| 17 |
| User | Count |
|---|---|
| 66 | |
| 65 | |
| 31 | |
| 26 | |
| 26 |