Forum Discussion

Giada_Togliatti's avatar
Giada_Togliatti
Icon for Post Patron rankPost Patron
5 years ago
Solved

problem with a formula in dax

Hi,

I need to make a formula where I should calculate only sales for current month:

I tired with calculate but it gives me error:

 

CALCULATE(sum(Orders[Sales]), month(Orders[Date])=[mese corrente]) 
where mese corrente is 
INT(month(Today()))
 
the error in the formula is:
A 'CALCULATE' function was used in a True / False expression used as a table filter expression. This is not allowed.


THANK YOU
  • Hi Giada_Togliatti ,

     

    Try this instead:

    _yourMeasure =
    CALCULATE(
      SUM(Orders[Sales]),
      FILTER(
        Orders,
        MONTH(Orders[Date]) = [mese corrente]
      )
    )

     

    Pete 

2 Replies

  • Hi Giada_Togliatti ,

     

    Try this instead:

    _yourMeasure =
    CALCULATE(
      SUM(Orders[Sales]),
      FILTER(
        Orders,
        MONTH(Orders[Date]) = [mese corrente]
      )
    )

     

    Pete