Forum Discussion

sadhnabatra's avatar
sadhnabatra
Frequent Visitor
9 years ago
Solved

How to sum up a quantity based on a date Filter

I want to see sum of revenue field for dates less than the selected date in the filter . So for example if I have selected '6/30/2017' then I want to see sum of revenue for dates less than this.

Can anybody help me with a DAX for this?

 

  • Hi sadhnabatra,

     

    According to your description above, you should be able to use the formula below to create a new measure to calculate the sum of revenue field for dates less than the selected date in the filter. :smileyhappy:

    Measure =
    CALCULATE (
        SUM ( Table1[Revenue] ),
        FILTER ( ALL ( Table1 ), Table1[Date] <= MAX ( Table1[Date] ) )
    )
    

     

    Regards

2 Replies

  • v-ljerr-msft's avatar
    v-ljerr-msft
    Microsoft Employee

    Hi sadhnabatra,

     

    According to your description above, you should be able to use the formula below to create a new measure to calculate the sum of revenue field for dates less than the selected date in the filter. :smileyhappy:

    Measure =
    CALCULATE (
        SUM ( Table1[Revenue] ),
        FILTER ( ALL ( Table1 ), Table1[Date] <= MAX ( Table1[Date] ) )
    )
    

     

    Regards

    • Anonymous's avatar
      Anonymous
      Not applicable

      Great! I want the filter to be were date = Max(date), how come that doesn't work and what can I do to get it to work? thanks!