none
Taular Project

    Question

  • HI

    I created a Tabular data warehouse using AdventureWorks2012. However I repeatedly get errors when trying to crate measures in the date table or any other using the date table.  For this following expression;

    :=CALCULATE(InternetSales[SalesAmount], LASTDATE('Date'[FullDateAlternateKey]))

    I get a error message stating  - values for Internet Sales Amount -- cannot be determined in the current context.

    and some cases state Date table cannot be found but some basic measures  in Date table works.

    Has limited DAX knowledge or pretty basic skill in the related area, appreciated help from the experts please.

    Cheers

    Mark


    Mark

    Sunday, December 22, 2013 10:41 PM

All replies

  • Hi channaNZ,

    This post looks like it belongs in the Power Pivot or SSAS forums but...

    You are receiving this error because the CALCULATE function is expecting a scalar expression for the first parameter. In this case you need to aggregate the values in the InternetSales[SalesAmount] column in some way so that it returns a scalar value.

    Your above calculation should work if you update the DAX formula to the following:

    SomeMeasures:=
    CALCULATE(
      SUM(InternetSales[SalesAmount]),
      LASTDATE('Date'[FullDateAlternateKey])
    )

    You can read more about the CALCULATE function here in the official TechNet library: http://technet.microsoft.com/en-us/library/ee634825.aspx 

    Hope this helps.

    Michael



    • Edited by Michael Amadi Wednesday, February 05, 2014 5:06 PM minor edit
    • Proposed as answer by Olaf HelperMVP Monday, February 10, 2014 8:32 AM
    Wednesday, February 05, 2014 5:05 PM
  • Thanks Micheal, I will try this and keep you posted


    Mark

    Wednesday, February 05, 2014 6:43 PM
  • Hi Mark,

    Have you had a chance to try this, yet?

    Michael


    Sunday, February 09, 2014 10:06 PM