Forum Discussion

Alex_DLV's avatar
Alex_DLV
New Member
7 months ago
Solved

Remaining Balance Depends on Prior Month

Hi everyone, I’m building a project revenue recognition system in Power BI and I want to confirm whether this type of rolling calculation is possible in DAX, given DirectQuery constraints. I’ll exp...
  • Olufemi7's avatar
    6 months ago

    Hello Alex_DLV,

    No this cannot be implemented in pure DAX measures, including in DirectQuery or Microsoft Fabric semantic models.


    Your calculation is recursive and stateful:

    • Remaining(N) depends on Recognized(N−1)
    • Recognized(N) depends on Remaining(N−1)
    • Overrides reset the cumulative state mid-timeline

    DAX does not support recursive calculations or circular dependencies between measures. Measures are evaluated independently and do not carry forward the result of a prior period’s calculation. This is consistent with Microsoft’s description of DAX evaluation context and measure behavior.

    Learn DAX basics in Power BI Desktop 

    Microsoft Fabric does support this scenario but not inside DAX.
    Fabric’s architecture expects complex, stateful, or iterative transformations to be completed before data reaches the semantic model.

    The semantic model (Direct Lake or DirectQuery) is designed for querying and aggregation, not procedural or recursive logic.

    Direct Lake overview 

    Conclusion:
    The rolling recognized/remaining logic must be pre-materialized upstream (SQL Analytics Endpoint, Warehouse, Lakehouse, Dataflow, or Spark). DAX should then be used only for slicing, filtering, and aggregation over the precomputed results.

  • FBergamaschi's avatar
    6 months ago

    Hi Alex_DLV,

    DAX is not recursive and will never be.

     

    Microsoft, though, provides a recursive language in Power BI for the ETL part: M (language of Power Query)

     

    So my suggestion is:

    1 - try to get the nrs precalculated from IT

    2 - if (1) does not work or is not applicable, use M to perform these values

     

    If this helped, please consider giving kudos and mark as a solution

    @me in replies or I'll lose your thread

    Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

    Consider voting this Power BI idea

    Francesco Bergamaschi

    MBA, M.Eng, M.Econ, Professor of BI