Forum Discussion

Matty's avatar
Matty
Helper II
4 years ago
Solved

SQL to DAX Question...

Hi All, What comes quite naturally to me in SQL can prove a bit more challenging to replicate in DAX based on my current knowledge level! Let's take the following simple example: SELECT DA.Sourc...
  • smpa01's avatar
    smpa01
    4 years ago

    Matty  I think this would be direct transalation 

    Table = ADDCOLUMNS(ADDCOLUMNS(Source,"Total_Sales_Plan",CALCULATE(SUM(Source[Sales_Plan]),ALLEXCEPT(Source,Source[Source_Plant], Source[Material],Source[Calendar_Week_Year])))
    "Sales_Plan_Ratio",coalesce(DIVIDE(Source[Sales_Plan],[Total_Sales_Plan]),0))

     

    if not, please provide a sample data and what is the output that TSQL generates