Forum Discussion

Chrism123's avatar
Chrism123
Frequent Visitor
8 years ago
Solved

Comparing Month and Year of Two dates

Hi,

 

I hope someone can help me with this problem.

 

I would like to compare Year and Month of two dates but I only know how to compare either month or year.

 

=CALCULATE('Measure'[Sales]+'Measure'[Backlog];

FILTER(all(date[Order Date]);

month(date[Order Date])=month([Last Batch Date])))

 

 

Thanks!

  • jthomson's avatar
    jthomson
    8 years ago

    Maybe try month(date[Order Date])=month([Last Batch Date])&&year(date[Order Date])=year([Last Batch Date]) instead?

4 Replies

  • jthomson's avatar
    jthomson
    Icon for Solution Sage rankSolution Sage

    You should just be able to add the same syntax you've used for the month section for the year as another argument in your calculate function

    • Chrism123's avatar
      Chrism123
      Frequent Visitor

      Hi, I already tried this, but it I get an error because there is only a maximum of 2 arguments allowed for the FILTER-function.

      • jthomson's avatar
        jthomson
        Icon for Solution Sage rankSolution Sage

        Maybe try month(date[Order Date])=month([Last Batch Date])&&year(date[Order Date])=year([Last Batch Date]) instead?