Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Query (2, 1) Failed to resolve name 'AG'. It is not a valid table, variable, or function name.

Getting the error "Query (2, 1) Failed to resolve name 'AG'. It is not a valid table, variable, or function name" with below query, please help Thanks! 

EVALUATE
AG =CONCATENATEX(  
        FILTER(
            'UAM',
            'UAM'[AG] = MAX('UAM'[AG])
        ),
        'UAM'[UG1],
        ";"
    )
 
 
Data table example before aggregation: 
UG1GROUP_TYPEAGITEM_TYPELOGINNAMETYPE
A-1UGAMAG1234Ana1
A-1UGAM1AG12345Ben1
A-2UGAMFAG123456Dan1

 

Databel table after aggregation:
UG   AG              
A-1   AM;AM1       
A-2   AMF

  • Hi Anonymous,

    After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used it as sample data on my end and successfully implemented it.    

    Dax Measure:

    AG_Concat_Duplicates =

    CONCATENATEX(

        FILTER(AGTable, AGTable[UG] = MAX(AGTable[UG])),

        AGTable[AG],

        ";"

    )

     

    I am also including .pbix file for your better understanding, please have a look into it:

    If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

    Thank you for using Microsoft Community Forum.

9 Replies

  • v-kpoloju-msft's avatar
    v-kpoloju-msft
    Community Support

    Hi Anonymous,
    Thank you for reaching out to the Microsoft fabric community forum. Thank you Dekubhanu_gautam, for your inputs on this issue.

    After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used it as sample data on my end and successfully implemented it.    

    Dax Measure for UAM Aggregated:
    UAM_Aggregated =

    ADDCOLUMNS(

        SUMMARIZE('UAM', 'UAM'[UG1]),

        "AG_Combined", CONCATENATEX(

            FILTER('UAM', 'UAM'[UG1] = EARLIER('UAM'[UG1])),

            'UAM'[AG],

            ";"

        )

    )


    I am also including .pbix file for your better understanding, please have a look into it:

    If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

    Thank you for using Microsoft Community Forum.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for the help , I am trying to get DISTINCT AG after CONCETENATE as right now the output will be as below: Tried to add in the DISTINCT function before FILTER but no luck, any clue? thanks  

      UG   AG              
      A-1   AM;AM;AM1     
      A-2   AMF;AMF

      • v-kpoloju-msft's avatar
        v-kpoloju-msft
        Community Support

        Hi Anonymous,

        After thoroughly reviewing the details you provided, I was able to reproduce the scenario, and it worked on my end. I have used it as sample data on my end and successfully implemented it.    

        Dax Measure:

        AG_Concat_Duplicates =

        CONCATENATEX(

            FILTER(AGTable, AGTable[UG] = MAX(AGTable[UG])),

            AGTable[AG],

            ";"

        )

         

        I am also including .pbix file for your better understanding, please have a look into it:

        If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

        Thank you for using Microsoft Community Forum.

  • Anonymous , Use 

     

    dax
    AG =
    CONCATENATEX(
    FILTER(
    'UAM',
    'UAM'[AG] = MAXX(ALL('UAM'), 'UAM'[AG])
    ),
    'UAM'[UG1],
    ";"
    )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks! 

      Getting the below: 
      Query (2, 1) The syntax for 'AG' is incorrect. (dax
      AG =
      CONCATENATEX(
      FILTER(
      'UAM',
      'UAM'[AG] = MAXX(ALL('UAM'), 'UAM'[AG])
      ),
      'UAM'[UG1],
      ";"
      )).

  • Deku's avatar
    Deku
    Super User

    When using EVALUATE the output needs to be a table

     

    You could something like

    Evaluate

    Define AG =CONCATENATEX(  

            FILTER(

                'UAM',

                'UAM'[AG] = MAX('UAM'[AG])

            ),

            'UAM'[UG1],

            ";"

        )

    {Ag}