Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

cumulative row number

Hi, I have a problem to calculate the cumulative row number, here is my data:

and I want to get the result row number, for example, when first yearmonth in table is 202201, there are 5 rows, and the result should return 5, when yearmonth is 202202, there are 3 rows, and there 8 rows in total, and when yearmonth=202203, the row number should be counted and added, 

do you have any ideas to solve it? Thank you.

  • Hi Anonymous,

     

    Please find the below screenshot and measure for your reference.

    Measure: 

    Cumulative Total =
    CALCULATE(COUNT('Table'[row number]),
    FILTER(ALL('Table'),
    'Table'[yearmonth] <= MAX( 'Table'[yearmonth] )
    )
    )
     
    Did I answer your question? Mark my post as a solution!
     
    Thanks,

1 Reply

  • Hi Anonymous,

     

    Please find the below screenshot and measure for your reference.

    Measure: 

    Cumulative Total =
    CALCULATE(COUNT('Table'[row number]),
    FILTER(ALL('Table'),
    'Table'[yearmonth] <= MAX( 'Table'[yearmonth] )
    )
    )
     
    Did I answer your question? Mark my post as a solution!
     
    Thanks,