Search code examples
powerbidaxdaxstudio

DAX calculation - Count of ids for all previous years than the selected year in the dropdown


How to get count of all the previous years than the selected year in the dropdown with multiple filter conditions.

                  CALCULATE(
                    COUNT(current_ar[request_id]),  
                     FILTER(current_ar, 
                   current_ar[Fiscal_Year] < SELECTEDVALUE(current_ar[Fiscal_Year]))) 

syntax is not working as expected. I want all the previous years count while the selection is made on the year dropdown. How the syntax can be written above??


Solution

  • You need to use ALL(...)

    Your Measure = CALCULATE(
        COUNT(current_ar[request_id]),  
        FILTER(
          ALL(current_ar[Fiscal_Year]),
          current_ar[Fiscal_Year] < SELECTEDVALUE(current_ar[Fiscal_Year])
        )
      )