locked
DAX for tabular model RRS feed

  • Question

  • Hi

    I´d like to ask the following. Is there any forum for tabular model? I know the DAX its the same from powerpivot.

    Anyway i´d like to ask a question: How to I make a year-1 calculation in DAX?

    something like:

    (

        PARALLELPERIOD

             ([Data Fattura].[Anno - Data].[Anno], 1 , [Data Fattura].[Anno - Data].currentmember) ,

              [Measures].[Fatturato]

    )

    edit:

    Been trying this, but it doesnt work. it tells me its some error into "-1" dateadd formula, but dunno why

    prueba:=calculate([Line Amount],DATEADD(Fechas[PK_Fecha],-1,YEAR))

     


     


    • Edited by the_txeriff Friday, September 28, 2012 9:54 AM
    Friday, September 28, 2012 9:16 AM

Answers

All replies

  • Hello,

    The Analysis Services forum would be a good place to ask DAX questions.   For PowerPivot and Tabular model prototyping in Excel, this forum would work as well.

    There *is* a PARALLELPERIOD function in DAX.  It does require the first parameter is a column of 'date' type.  Same applies to the DAX 'DATEADD' function.

    check the type of your Fechas[PK_Fecha] column.  By the name 'PK', I would deduce it is an integer type, and this is not allowed for a PARALLELPERIOD or DATEADD first parameter.




    Javier Guillen
    http://javierguillen.wordpress.com/

    Friday, September 28, 2012 12:40 PM
    Answerer
  • the PK_Fecha is a datetime primary key ex: (01/01/12 00:00:00) so it should work like:

    prueba:=calculate([Line Amount],DATEADD(Fechas[PK_Fecha],-1,YEAR))

    but it tells me some error near "-1". No idea what to do.

    Friday, September 28, 2012 1:00 PM
  • can you post the exact error you get?



    Javier Guillen
    http://javierguillen.wordpress.com/

    Friday, September 28, 2012 7:11 PM
    Answerer
  • TXeriff,

    Is this still an issue?

    Thanks!


    Ed Price, SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!

    Friday, November 1, 2013 5:39 PM