Forum Discussion

heetu24's avatar
heetu24
Icon for Helper I rankHelper I
2 years ago
Solved

Cumulative sales

Hello, All I am stuck in one scenario.   Scenario: As per below screens shot. There is filter of Period and Year in Green color. In Power BI Period and Year are slicers. In Year column records a...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi All
    Fisrtly Irwan  thank you for your solution!
    And heetu24, We just need to make a slight change in Irwan's DAX, and the filtering of YEARS with the selectedvalue function can be done to accumulate different years.

    Measure = 
    VAR A=SELECTEDVALUE('data'[Year])
    VAR C=MAX(data[Index])
    VAR B=CALCULATE(
        SUM('data'[Sales Value]),FILTER(ALL('data'),
       'data'[Year]=A&&'data'[Index]<=C)
        )
        RETURN
        IF(
            MAX('data'[Index])=1,
            0,
            B)

    If you have any other questions, check out the pbix file I uploaded, I hope it helps!

     

    Hope it helps!

     

    Best regards,
    Community Support Team_ Tom Shen

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.