Forum Discussion

shubhamc_002's avatar
shubhamc_002
Helper I
3 years ago

Cumulative Sum based on multiple filter context

Hi Team , 

 

Need one help on one scenario in DAX. 
I want to create a measure for cumulative sum which can Dynamically accept the external filter context without hardcoding in measure. Below measure is perfectly working fine but this solution is like hardcoding field names(  'Table 2'[Column1], 'Table 2'[Column2], 'Table 2'[Column3]) in allexcept is not appropriate solution.
 Our requirement is to generate cumulative sum of total sales based on multiple filter context dynamically instead of hardcoding field names in all except.

measure = 
Calculate(
      [Total Sales], 
       filter(
          Allexcept('Table 1',
                           'Table 2'[Column1],
                             'Table 2'[Column2], 
                               'Table 2'[Column3]), 
                                 'Table 1'[order Date]<=MAX('Table 1'[order Date])
                           )
                      )
Please let us know if this can be done by any other approach. 


Thanks

1 Reply