Forum Discussion

Clockwise's avatar
Clockwise
Helper I
7 months ago
Solved

Basic DAX Issue

I have created measures before but have not used the DAX Query View, now tried to do basic things but I am failing in anything, 

I understand I am new to this but sounds I am missing something  basic

 

Test_Measure = sum('Table 1'[AQuality])

 

then I hit the Run and at the bottom I see Results window below it  says "Resolve the error to see the results." and it does not show me where is the error. Even something like

 

Test = 2+3 

 

fails with similar error. What am I missing? 

  • You’re writing measure definitions in DAX Query View and pressing Run. But DAX Query View does not accept measure definitions.

     

    Example 1: simple calculation

    EVALUATE
    ROW ( "Result", 2 + 3 )

     

    Example 2: test your aggregation

    EVALUATE
    SUMMARIZE (
        'Table 1',
        "Total AQuality", SUM ( 'Table 1'[AQuality] )
    )

    Now press Run → results will appear.

     

    DAX Query View runs queries (EVALUATE …), not measure definitions. Create measures in the measure editor, or wrap logic in EVALUATE when using Query View.

6 Replies

  • RV0251's avatar
    RV0251
    Frequent Visitor

    Hi, You’re not missing anything obvious this is just how DAX Query View works, and it’s a bit confusing at first. The key thing is that DAX Query View does NOT run measures. It only runs DAX queries. So when you write something like: Test_Measure = SUM ( 'Table 1'[AQuality] ) or even: 2 + 3 it will always fail there, even though those are perfectly valid DAX expressions. In DAX Query View, everything has to be a query, and queries must start with EVALUATE. For example, this will work: EVALUATE ROW ( "Result", 2 + 3 ) Or for your column sum: EVALUATE ROW ( "Total AQuality", SUM ( 'Table 1'[AQuality] ) ) You should see the result in the Results pane after running it. If your goal is just to create a measure, you don’t need DAX Query View at all. Just go to New measure in Report or Model view and paste: Test_Measure = SUM ( 'Table 1'[AQuality] ) Think of DAX Query View more like running a SQL SELECT statement it’s for testing queries, not defining measures. This trips up a lot of people at first, so you’re definitely not alone

  • You’re writing measure definitions in DAX Query View and pressing Run. But DAX Query View does not accept measure definitions.

     

    Example 1: simple calculation

    EVALUATE
    ROW ( "Result", 2 + 3 )

     

    Example 2: test your aggregation

    EVALUATE
    SUMMARIZE (
        'Table 1',
        "Total AQuality", SUM ( 'Table 1'[AQuality] )
    )

    Now press Run → results will appear.

     

    DAX Query View runs queries (EVALUATE …), not measure definitions. Create measures in the measure editor, or wrap logic in EVALUATE when using Query View.

    • Clockwise's avatar
      Clockwise
      Helper I

      Thanks for the reply. Actually I was reading that page too, so I changed the formulae to something like this. 

      to 

       

      Define

      measure 'Table1'[Measure_test] = sum('Table1'[AQuality])

      Evaluate 

      SUMMARIZECOLUMNS(
              "Measure_test", [Measure_test]
          )

       

       

      it seems something is working but not fully now, so got this error now. 

       

      A single value for column 'AQuality' in table 'Table1' cannot be determined. This can happen when a measure or function formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

       

      I guess the sum was not the right choice,