I have a code and outcome as below
EVALUATE
VAR AggregatedSalesInCurrency =
ADDCOLUMNS (
SUMMARIZE(
'OPC SUMMARY (2)',
'Calendar'[Date],
'dimCurrency'[Currency Code]
),
"@SalesAmountInCurrency", [Sales (Internal)],
"@Rate", CALCULATE (
SELECTEDVALUE ( 'factFX'[FX Rate] )
)
)
RETURN
AggregatedSalesInCurrency
But if I add the SUMX function say the expression specified in the query is not a valid table expression
why would that be? many thanks in advance.
EVALUATE
VAR AggregatedSalesInCurrency =
ADDCOLUMNS (
SUMMARIZE(
'OPC SUMMARY (2)',
'Calendar'[Date],
'dimCurrency'[Currency Code]
),
"@SalesAmountInCurrency", [Sales (Internal)],
"@Rate", CALCULATE (
SELECTEDVALUE ( 'factFX'[FX Rate] )
)
)
//RETURN
//AggregatedSalesInCurrency
VAR Result =
SUMX (
AggregatedSalesInCurrency,
[@SalesAmountInCurrency] / [@Rate]
)
RETURN
Result
You're in DAX Studio and so need to return a table. Try wrapping your return in curly braces.