Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

The syntax for ")" is incorrect

Hello, I am trying to create a measure that highlights a bar when i have made a selection on a slicer.
I have created this measure however when i click enter it says the syntax for ")" is incorrect.
 
I dont know what the problem with the measure below is to cause this error. Any help would be appreciated!
 
VAR _selectedborough = VALUES('London island'[London borough ])
var _boroughtohighlight = SELECTEDVALUE('London Selection'[Borough/region])
VAR _filtered = ISFILTERED('London island'[London borough ])
VAR _result =
SWITCH (TRUE,
NOT(_filtered),"#0079EB",
_boroughtohighlight IN _selectedborough
&&_filtered,"#0079EB",
"#99C9F7"
)
  • Anonymous's avatar
    Anonymous
    5 years ago

    Anonymous 

    Please replace TRUE function to TRUE()

     

    VAR _result =
    SWITCH (TRUE(),
    NOT(_filtered),"#0079EB",
    _boroughtohighlight IN _selectedborough
    &&_filtered,"#0079EB",
    "#99C9F7"
    )
     
    Paul Zheng _ Community Support Team
    If this post helps, please Accept it as the solution to help the other members find it more quickly.

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous 

    Please replace TRUE function to TRUE()

     

    VAR _result =
    SWITCH (TRUE(),
    NOT(_filtered),"#0079EB",
    _boroughtohighlight IN _selectedborough
    &&_filtered,"#0079EB",
    "#99C9F7"
    )
     
    Paul Zheng _ Community Support Team
    If this post helps, please Accept it as the solution to help the other members find it more quickly.
  • Anonymous's avatar
    Anonymous
    Not applicable

    Ah sorry i missed a line at the top

     

    VAR _selectedborough = VALUES('London island'[London borough ])
    • amitchandak's avatar
      amitchandak
      Icon for Super User rankSuper User

      Anonymous , Try like

       

      VAR _selectedborough = VALUES('London island'[London borough ])
      var _boroughtohighlight = SELECTEDVALUE('London Selection'[Borough/region])
      VAR _filtered = ISFILTERED('London island'[London borough ])
      VAR _result =
      SWITCH (TRUE,
      NOT(_filtered),"#0079EB",
      countx(filter( 'London island', 'London island'[London borough ] in SELECTEDVALUE('London Selection'[Borough/region])), 'London island'[London borough ]) +0>0 &&  _filtered, "#0079EB",
      "#99C9F7"
      )