Forum Discussion

sgupta22's avatar
sgupta22
Icon for Helper II rankHelper II
3 years ago
Solved

Cumulative totals between slicer dates

Hi everyone,   I am currently using the following formula to compute the cumulative total for a field: Cumulative PBT = CALCULATE([Adjusted PBT], FILTER(ALL('Calendar'), 'Calendar'[Date] <= M...
  • v-yueyunzh-msft's avatar
    3 years ago

    Hi , sgupta22 

    According to your description, you want to calculate the Cumulative total with the year slicer. Right?

    Here are the steps you can refer to :
    (1)This is my test data:

    (2)I create a calendar date like yours:

    (3)Then we can create a measure :

    Measure = var _current_date = MAX('Calendar'[Date])
    var _min_date = MINX( ALLSELECTED('Calendar') , [Date])
    var _t  = FILTER( ALLSELECTED('Table') , 'Table'[Date] <= _current_date && 'Table'[Date] >= _min_date)
    return
    SUMX(_t , [Value])

    (4)Then we put the 'Calendar'[Year] on the slicer visual and the 'Table'[Date], [Measure] on the table visual and then we can meet your need:

     

     

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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