Forum Discussion

ARTarabein's avatar
ARTarabein
New Member
7 years ago
Solved

Count Values in TTM Measure

Hi,    I am trying to come up with the count of values that are yielding my TTM Measure total. The aim is to make sure that there is always 12 month of values yielding my current and Last Year TTM ...
  • ARTarabein's avatar
    ARTarabein
    7 years ago

    So I figured this one out:

     

    to count mnth in current quarter 

    Count:=CALCULATE(COUNT([Sales]),DATESINPERIOD('Calendar'[Date],MAX('Calendar'[Date]),-1,QUARTER))

     

    to count mnths in last year quarter:

    Last Count:=CALCULATE([Count],SAMEPERIODLASTYEAR('Calendar'[Date]))

     

    then my current quarter total sales would be

    SSQUARTER:=if(and([Count]=3,[Last Count]=3),CALCULATE(sum([Sales]),DATESINPERIOD('Calendar'[Date],max('Calendar'[Date]),-1,QUARTER)))

     

    And last year's 

     

    SSLastQ:=if(and([Count]=3,[Last Count]=3),CALCULATE([QUARTER],SAMEPERIODLASTYEAR('Calendar'[Date])))