Forum Discussion

JoeAPH's avatar
JoeAPH
Regular Visitor
7 years ago
Solved

Introducing Month field from Calendar changes YTD calculation

I have a measure
 
 
Sales YTD = CALCULATE([Ttl Sales],
FILTER(trans,year(trans[DATE])=MAX(Calendar2[Year])),
FILTER(trans,trans[Hold?]="n"))
 
Note: Ttl Sales = Sum(trans[NetSales])
 
In my chart this measure correctly computes as expected ie gives me the total Net Sales in the 'trans' table for transactions dated in the current year (which is the max year in my Calendar2 table
 
So all is well.
 
However, when I introduce the Month field (which is an integer in my Calendar2 table), the chart shows the Net Sales per year for the year to date, but then shows Net Sales for last year for the remaining Months.
 
Can anyone explain this please?
 
 
 
  • Hi

     

    I added the RETURN command, and it is working perfectly!

     

    Many thanks

     

    Joe

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    JoeAPH - Does your calendar table include future dates?

    • JoeAPH's avatar
      JoeAPH
      Regular Visitor

       Hi

       

      Thank you for your time!

       

      No. Calendar cust off at current day.

       

      Joe