Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

CONVERT SQL QUERY TO DAX Measure

Hi ,

Please Help me .

I want to convert sql  qury into  DAX Measure 

 

-----------SQL Query -------------------------

DECLARE @DATE AS DATETIME SET @DATE='200-12-03'

 

select SUM(Account_Balance) FROM DepDeposit WHERE As_Of_Date=dateadd(DD, -1, dateadd(YY,datediff(yy,0,@DATE),0))

 

 

9 Replies

  • vanessafvg's avatar
    vanessafvg
    Community Champion

    Anonymousare you trying to get last years values?

     

    do you have a date table?  if so you can use

     

    daxmeasure = calculate(sum(account_balance)), SAMEPERIODLASTYEAR(DateTime[DateKey]))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Dear vanessafvg,
      thanks for your answer.

      yes I want to get last years values
      but the resultes show with me not the same sql query resulte , also i don't have date table, how i can cearte **bleep** and what are the values must be inside table to apply your answer ,

      kindly find snapshop image after applying your answer without date table , i use only my attribute called "as_of_date

      "