Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

DAX Studio – Expression specified in the query is not a valid table expression

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

outcome table

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

   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
    

>Solution :

You’re in DAX Studio and so need to return a table. Try wrapping your return in curly braces.

RETURN
    {Result}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading