Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Calculated Column Self Referencing Itself at Prior Period

For a little bit of background on the problem, I have monthly data with various products. Products can span many months and many products can be active during the same months. Each product has a fiel...
  • v-janeyg-msft's avatar
    v-janeyg-msft
    4 years ago

    Hi, Anonymous 

     

    Powerbi doesn't support recursion, but your needs are not completely recursive, it should be supported.

    How about this:

    Allocated Quantity =
    VAR TOTAL =
        SUMX (
            FILTER (
                Table,
                [Date] <= EARLIER ( Table[Date] )
                    && [Product] = EARLIER ( Table[Product] )
            ),
            [Monthly Quantity to Assign]
        )
    VAR maxquantity =
        MAXX (
            FILTER ( Table, [Product] = EARLIER ( Table[Product] ) ),
            [Max Quantity]
        )
    RETURN
        IF ( TOTAL > maxquantity, 0, TOTAL )
    

     

    Best Regards,
    Community Support Team _ Janey
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.