Forum Discussion

vijaykumarj19's avatar
vijaykumarj19
Icon for Microsoft Employee rankMicrosoft Employee
5 years ago
Solved

Cumulative sum zero values should display previous values till end values

c1c2c3
may 20203232
jun 20202254
jul 2020 54
aug 2020 54
sept 20203488
oct 2020290
nov 2020  
dec 2020  

 

I have c2 column and need to display c3 running total but blank values before last value should display previous values

my table is connected to date table 

 

my measure:

CALCULATE(
    sum(c2),
    FILTER(
        CALCULATETABLE(
            SUMMARIZE(
                'Date Table',
                'Date Table'[cc_year-Month Sort],
                'Date Table'[Year Month]
            ),
            ALLSELECTED('Date Table')
        ),
        ISONORAFTER(
            'Date Table'[cc_year-Month Sort], MAX('Date Table'[cc_year-Month Sort]), DESC,
            'Date Table'[Year Month], MAX('Date Table'[Year Month]), DESC
        )
    )
)

 

but displaying cumulative till last 

 

12 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Icon for Community Champion rankCommunity Champion

    vijaykumarj19 assume c1 from date table then try this code

    =var _currentYM=max(datetable[year month]) return calculate(sum(c2),datetable[year month]<=_currentYM)

      • vijaykumarj19's avatar
        vijaykumarj19
        Icon for Microsoft Employee rankMicrosoft Employee

        My table

         

         

        calculating cumulative and ploted in line graph

         

        Below line should stop at a6 

        Dax :

        c2 running total in c1 =
        CALCULATE(
            SUM('Table'[c2]),
            FILTER(
                ALLSELECTED('Table'[c1]),
                ISONORAFTER('Table'[c1], MAX('Table'[c1]), DESC)
        ))
         
         
  • If tried same scenario and try to filter the data by using slicer which I created from date field it is not giving correct count.