Forum Discussion

powerbiuser9999's avatar
5 years ago
Solved

Using a variable date in a CALCULATE function

Hi I wonder if someone can help me, I have a project that involves using a CALCULATE function, and adding some filter values at the end of the function. One of these needs to a date value which is...
  • V-lianl-msft's avatar
    V-lianl-msft
    5 years ago

    Please try to create a measure like below:

    Measure 2 = CALCULATE(DISTINCTCOUNT('Table (2)'[Column]),FILTER(ALL('Table (2)'),'Table (2)'[Column1]=1&&YEAR('Table (2)'[date])=SELECTEDVALUE('Table (2)'[date].[Year])-1))

    For more details,please refer to this sample .pbix