Forum Discussion

vanessafvg's avatar
vanessafvg
Icon for Community Champion rankCommunity Champion
9 years ago
Solved

Current Fiscal month sales - DAX Error

I want to get the current sales in month for the Fiscal Date

 

this is my DAX Statement

 

Current Month Sales = CALCULATE(
SUM(Registrations[Revenue]),
FILTER('Date','Date'[FYMonthInYear] = MONTH(now())
&& 'Date'[FYYear]) = YEAR(NOW()))

 

this is the error 

A function 'FILTER' has been used in a True/False expression that is used as a table filter expression. This is not allowed

 

I am obviously missing how this statement works, help?

  • Please try this

     

    Current Month Sales = CALCULATE(
    SUM('Registrations'[Revenue]),
    FILTER(
    'Date',
    'Date'[FYMonthInYear]=MONTH(NOW())
    && 'Date'[FYYear]=YEAR(Now()) )
    )

     

     

    There is a really really subtle difference in where you have your closing brackets.

3 Replies

  • Phil_Seamark's avatar
    Phil_Seamark
    Icon for Microsoft Employee rankMicrosoft Employee

    Please try this

     

    Current Month Sales = CALCULATE(
    SUM('Registrations'[Revenue]),
    FILTER(
    'Date',
    'Date'[FYMonthInYear]=MONTH(NOW())
    && 'Date'[FYYear]=YEAR(Now()) )
    )

     

     

    There is a really really subtle difference in where you have your closing brackets.

    • computermike's avatar
      computermike
      Icon for Helper I rankHelper I

      Very Nice

       

      So say we are in Feb. and it works great.  But when I filter my Pivot table for Jan, the values disappear.  How could I alter my query, so it is unaffected by a date filter in my pivot table?