Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Filter with date slicer and dynamic offset

Hello,   I am trying to solve a situation with date slicers and a custom offset. I will try to explain it.   I have a table with orders and returns like this: id order_date return_date uni...
  • stevedep's avatar
    stevedep
    6 years ago

    Like this?

    sales_sum_slicer = 
    VAR MaxDate = MAX ('Date'[Date] ) 
    VAR MinDate = MIN('Date'[Date])
    VAR DaysBeforeDatea= MaxDate - 4
    RETURN
    
        CALCULATE (
           CALCULATE(SUM('Table'[units_bought]));          --
          'Date'[Date]<= DaysBeforeDatea; 'Date'[Date] >= MinDate;  
            ALL ( 'Date' )               
        )

     

     

    File is here.

     

    Kind regards, Steve 

    pls mark as solved when your query has been answered.