Forum Discussion
Cipriano
4 years agoHelper III
Recursive calculation in table using DAX
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...
- Anonymous4 years ago
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 ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
4 years agoNot applicable
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.
Cipriano
4 years agoHelper III
I really appreciate your support, regards.