Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

cumulative sum

Hi all,   I have following table   year month sales 2024 january 10 2024 february 20 2024 march 30 2024 april 40 2024 may 50 2024 june 60 2024 july 70 2...
  • Jihwan_Kim's avatar
    1 year ago

    Hi,

    I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file.

     

     

     

     

    Sales: = 
    SUM(sales[sales])

     

    WINDOW function (DAX) - DAX | Microsoft Learn

     

    Cumulative sales: = 
    CALCULATE (
        [Sales:],
        WINDOW (
            1,
            ABS,
            0,
            REL,
            ALL ( 'calendar'[Year], 'calendar'[Month name], 'calendar'[Month number] ),
            ORDERBY ( 'calendar'[Month number], ASC ),
            ,
            PARTITIONBY ( 'calendar'[Year] )
        )
    )