Forum Discussion

roger360's avatar
roger360
Frequent Visitor
1 year ago
Solved

Getting Syntax Error: Invalid Token, Line 3, Offset2, .

TopTeam =
VAR TopTeamTable =
    ADDCOLUMNS(
        SUMMARIZE(
            FILTER(
                Table15924,
                NOT(ISBLANK(Table15924[Redirection to?]))
            ),
            Table15924[Redirection to?]
        ),
        "Count", COUNTROWS(Table15924)
    )
VAR MaxCount = MAXX(TopTeamTable, [Count])
RETURN
    CALCULATE(
        FIRSTNONBLANK(Table15924[Redirection to?], 1),
        FILTER(TopTeamTable, [Count] = MaxCount)
    )


Th above new measure is to find the most frequest team where the calls were redirected to, excluding the blank cells. Getting the following error message. Please help! Let me know if you need any further details.

 



  • Hi roger360 ,
    Here’s a corrected version of your measure:

    TopTeam = 
    VAR TopTeamTable =
        ADDCOLUMNS(
            SUMMARIZE(
                FILTER(
                    Table15924,
                    NOT(ISBLANK(Table15924[Redirection to?]))
                ),
                Table15924[Redirection to?]
            ),
            "Count", CALCULATE(COUNTROWS(Table15924))
        )
    VAR MaxCount = MAXX(TopTeamTable, [Count])
    RETURN
        CALCULATE(
            FIRSTNONBLANK(Table15924[Redirection to?], 1),
            FILTER(TopTeamTable, [Count] = MaxCount)
        )
    
     

6 Replies

  • Deku's avatar
    Deku
    Super User

    Try this

     

    TopTeam =
    VAR TopTeamTable =
    ADDCOLUMNS(

    Filter(

    ALL(Table15924[Redirection to?]),

    Not ISBLANK(Table15924[Redirection to?])

    ),
    "@Count", CALCULATE(COUNTROWS(Table15924))
    )

    Return

    MAXX( 
    TOPN(1, TopTeamTable, [@Count], DESC),

    Table15924[Redirection to?]

    )

      • Deku's avatar
        Deku
        Super User

        Added a missing comma, need on row 11 on your image

  • Hi roger360 ,
    Here’s a corrected version of your measure:

    TopTeam = 
    VAR TopTeamTable =
        ADDCOLUMNS(
            SUMMARIZE(
                FILTER(
                    Table15924,
                    NOT(ISBLANK(Table15924[Redirection to?]))
                ),
                Table15924[Redirection to?]
            ),
            "Count", CALCULATE(COUNTROWS(Table15924))
        )
    VAR MaxCount = MAXX(TopTeamTable, [Count])
    RETURN
        CALCULATE(
            FIRSTNONBLANK(Table15924[Redirection to?], 1),
            FILTER(TopTeamTable, [Count] = MaxCount)
        )
    
     
  • v-nmadadi-msft's avatar
    v-nmadadi-msft
    Community Support

    Hi roger360 

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

     

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

    Hi roger360 ,

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If our responses has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


    Thank you.