Forum Discussion

SIMMI's avatar
SIMMI
Frequent Visitor
3 years ago
Solved

Filtered table sum

Hi,

 

I was trying to get the sum of all the values recorded in the past 24 months. My knowledge with DAX is very basic. I have applied filters, but it's working at each row level. I want the filters to be applied at the table level. What I'm getting currently is:

whereas what I'm looking for is:

RaisedDateClosedDateMonthSummaryValueTEST
01/01/202005/01/202001/01/202010
02/02/202002/02/202001/02/202031
03/03/202003/03/202001/03/202024
04/03/202001/04/202001/04/202046
01/01/202010/04/202001/04/202026
05/06/202005/06/202001/06/2020212
01/01/202102/01/202101/01/2021314
01/05/202102/05/202101/05/2021217
06/06/202101/08/202101/08/2021419
02/01/202203/01/202201/01/2022223
03/03/202203/03/202201/03/2022321
04/04/202204/04/202201/04/2022222

 

Kindly help.

 

Thanks.

  • Hi , SIMMI 

    Thanks for the sample data you provide.

    Here are the steps you can refer to :
    (1)My test data is the same as yours.

    (2)We can create a measure like this:

    Measure = var _cur_month = MAX('Table'[MonthSummary])
    var _pre_24month = EOMONTH(_cur_month,-25)
    var _t = FILTER( ALLSELECTED('Table') ,'Table'[MonthSummary]>_pre_24month && 'Table'[MonthSummary]< _cur_month)
    return
    SUMX(_t , [Value])+0

    (3)Then we can meet your need:

    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

3 Replies

  • Hi , SIMMI 

    Thanks for the sample data you provide.

    Here are the steps you can refer to :
    (1)My test data is the same as yours.

    (2)We can create a measure like this:

    Measure = var _cur_month = MAX('Table'[MonthSummary])
    var _pre_24month = EOMONTH(_cur_month,-25)
    var _t = FILTER( ALLSELECTED('Table') ,'Table'[MonthSummary]>_pre_24month && 'Table'[MonthSummary]< _cur_month)
    return
    SUMX(_t , [Value])+0

    (3)Then we can meet your need:

    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

    • SIMMI's avatar
      SIMMI
      Frequent Visitor
      RaisedDateClosedDateMonthSummaryValue
      01/01/202005/01/202001/01/20201
      01/01/202010/04/202001/04/20202
      02/02/202002/02/202001/02/20203
      03/03/202003/03/202001/03/20202
      04/03/202001/04/202001/04/20204
      05/06/202005/06/202001/06/20202
      01/01/202102/01/202101/01/20213
      01/05/202102/05/202101/05/20212
      06/06/202101/08/202101/08/20214
      02/01/202203/01/202201/01/20222
      03/03/202203/03/202201/03/20223
      04/04/202204/04/202201/04/20222