Forum Discussion
proyectado por mes
- Anonymous1 year ago
Hi, pablol1235
Thank you for your prompt response. I now fully understand your requirements.I apologize for the delay. I realize that your needs involve very complex recursion, specifically the SUM(P43:U43) part. Recursion cannot be implemented in DAX. While this is easily achievable in Excel, it is not possible in DAX. Recursive calculations require row-by-row data processing, which is incompatible with DAX's batch processing mode. Here is a screenshot from the relevant documentation:
For further details, please refer to:
Solved: Power BI Recursion - DAX - Microsoft Fabric Community
Solved: Recursion in DAX - Microsoft Fabric Community
Previous Value (“Recursion”) in DAX – Greg Deckler
Currently, I have managed to implement all parts except for the SUM(P43:U43) portion based on the calculated table. However, the recursion, represented by my variables P1 and F1, cannot fulfill your requirements.
Table 2 = VAR t1 = SUMMARIZE( 'Table', 'Table'[month], 'Table'[Mes], 'Table'[blank] ) VAR t2 = SUMMARIZE( 'Table', 'Table'[month], "Mes", VAR CM = 'Table'[month] VAR v40 = CALCULATE( SUM('Table'[Mes]), FILTER( ALL('Table'), 'Table'[month] = CM && 'Table'[blank] = "Compras AA" ) ) VAR D1 = CALCULATE( SUM('Table'[Mes]), FILTER( ALL('Table'), 'Table'[month] < CM && 'Table'[month] >= EDATE( CM, -7 ) && 'Table'[blank] = "Compras AA" ) ) VAR SECOND = (v40 / D1 - 1) * 0.5 + 1 VAR LM = EDATE( 'Table'[month], -12 ) VAR J40 = CALCULATE( SUM('Table'[Mes]), FILTER( ALL('Table'), 'Table'[month] = LM && 'Table'[blank] = "Compras AA" ) ) VAR D2 = CALCULATE( SUM('Table'[Mes]), FILTER( ALL('Table'), 'Table'[month] < LM && 'Table'[month] >= EDATE( LM, -7 ) && 'Table'[blank] = "Compras AA" ) ) VAR THRID = (J40 / D2 - 1) * 0.5 + 1 VAR F = DIVIDE( (SECOND + THRID), 2 ) VAR P1 = CALCULATE( SUM('Table'[Mes]), FILTER( ALL('Table'), 'Table'[month] < CM && 'Table'[month] >= EDATE( CM, -7 ) && 'Table'[blank] = "Compras A. Vig." ) ) VAR F1 = DIVIDE( P1, 6 ) * F RETURN IF( ISERROR(F1), BLANK(), F1 ), "blank", "Compra Proyectada" ) VAR F2 = UNION( t1, t2 ) RETURN F2Please find the attached pbix relevant to the case.
Thank you for your effort and understanding.Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Por las dudas que no puedas abrir el enlace de github que envie
Hi, pablol1235
Thank you for your prompt response. I now fully understand your requirements.
I apologize for the delay. I realize that your needs involve very complex recursion, specifically the SUM(P43:U43) part. Recursion cannot be implemented in DAX. While this is easily achievable in Excel, it is not possible in DAX. Recursive calculations require row-by-row data processing, which is incompatible with DAX's batch processing mode. Here is a screenshot from the relevant documentation:
For further details, please refer to:
Solved: Power BI Recursion - DAX - Microsoft Fabric Community
Solved: Recursion in DAX - Microsoft Fabric Community
Previous Value (“Recursion”) in DAX – Greg Deckler
Currently, I have managed to implement all parts except for the SUM(P43:U43) portion based on the calculated table. However, the recursion, represented by my variables P1 and F1, cannot fulfill your requirements.
Table 2 =
VAR t1 = SUMMARIZE(
'Table',
'Table'[month],
'Table'[Mes],
'Table'[blank]
)
VAR t2 = SUMMARIZE(
'Table',
'Table'[month],
"Mes", VAR CM = 'Table'[month]
VAR v40 = CALCULATE(
SUM('Table'[Mes]),
FILTER(
ALL('Table'),
'Table'[month] = CM && 'Table'[blank] = "Compras AA"
)
)
VAR D1 = CALCULATE(
SUM('Table'[Mes]),
FILTER(
ALL('Table'),
'Table'[month] < CM && 'Table'[month] >= EDATE(
CM,
-7
) && 'Table'[blank] = "Compras AA"
)
)
VAR SECOND = (v40 / D1 - 1) * 0.5 + 1
VAR LM = EDATE(
'Table'[month],
-12
)
VAR J40 = CALCULATE(
SUM('Table'[Mes]),
FILTER(
ALL('Table'),
'Table'[month] = LM && 'Table'[blank] = "Compras AA"
)
)
VAR D2 = CALCULATE(
SUM('Table'[Mes]),
FILTER(
ALL('Table'),
'Table'[month] < LM && 'Table'[month] >= EDATE(
LM,
-7
) && 'Table'[blank] = "Compras AA"
)
)
VAR THRID = (J40 / D2 - 1) * 0.5 + 1
VAR F = DIVIDE(
(SECOND + THRID),
2
)
VAR P1 = CALCULATE(
SUM('Table'[Mes]),
FILTER(
ALL('Table'),
'Table'[month] < CM && 'Table'[month] >= EDATE(
CM,
-7
) && 'Table'[blank] = "Compras A. Vig."
)
)
VAR F1 = DIVIDE(
P1,
6
) * F
RETURN
IF(
ISERROR(F1),
BLANK(),
F1
),
"blank", "Compra Proyectada"
)
VAR F2 = UNION(
t1,
t2
)
RETURN
F2
Please find the attached pbix relevant to the case.
Thank you for your effort and understanding.Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- pablol12351 year ago
Helper I
Muchas gracias por la repuesta
Entiendo lo que me dices y entiendo por qué no se puede
Con respecto al resto que me envías me funcionó muy bien
Muchas gracias por el esfuerzo y la paciencia
Slds