Forum Discussion

CraigBlackman's avatar
CraigBlackman
Helper III
10 years ago
Solved

Function 'DATEADD' only works with contiguous date selections.

Hi All,

 

I have this error which is a measure calculated from net sales DATEADD -1 year.

 

MdxScript(Model) (1, 134) Calculation error in measure 'DimDate'[P/Y Sales1]: Function 'DATEADD' only works with contiguous date selections.

 

Unsure how i get over this so any help really appreciated.

 

Thanks 

 

Craig

  • konstantinos's avatar
    konstantinos
    10 years ago

    CraigBlackmanYou can try  P/Y Sales = CALCULATE ( [Net Sales]; SAMEPERIODLASTYEAR( Dates[Date]))

    or wrap your P/Y Sales with SUMX 

    P/Y Sales = SUMX ( salestable; calculate( [Net Sales]; DATEADD( Dates[Date]; -1 ; Year )) 

     

9 Replies

    • CraigBlackman's avatar
      CraigBlackman
      Helper III

      Hi,

       

      Thanks for that. The issue is that I want to display a total for these columns.

       

      I have this table, the P/Y Sales and P/Y Orders a\re the problem columns here, both based on the current date -1 Year.

       

      Maybe I can calacultae this in another fashion?

       

      Capture.PNG

      • konstantinos's avatar
        konstantinos
        Memorable Member

        CraigBlackmanYou can try  P/Y Sales = CALCULATE ( [Net Sales]; SAMEPERIODLASTYEAR( Dates[Date]))

        or wrap your P/Y Sales with SUMX 

        P/Y Sales = SUMX ( salestable; calculate( [Net Sales]; DATEADD( Dates[Date]; -1 ; Year ))