Forum Discussion

jpereztang's avatar
jpereztang
Helper I
8 years ago
Solved

Related filtering with years

Hi everyone,   I hope u can help me with this.    These are my two tables.       Sales ant Time and I have a measure that is:    TotSales = CALCULATE( SUM(Sales[SalesAmount...
  • Anonymous's avatar
    Anonymous
    8 years ago

    The following measure should work:

     

    OriginSales =
    VAR SlicerYear =
    SELECTEDVALUE ( CalendarTable[Year] )
    RETURN
    CALCULATE ( [TotSales], SalesTable[Origin Year] = SlicerYear )

     

    We create a variable called SlicerYear that stores the current value from the slicer.

    We then modify the filter context by using CALCULATE(), and specify that we want SalesTable[OriginYear] to equal the stored SlicerYear value.

     

    All the best,

     

    ~ Chris H