Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to Get Formula to Work

Hi - I have this formula for a column in PowerBI: 

=IF(LEFT(vBI_ClientBankAccounts[Bank Account CUSIP],2)= "CD", "CD", IF(LEFT(vBI_ClientBankAccounts[Bank Account CUSIP],3)= "TBS", "TBS", "AMMA"))
 
I am getting this error: To use special characters in a column name, enclose the entire name in brackets ([]) and add a ] to any closing brackets in the name.
 
vBI_ClientBankAccounts is my data view and Bank Account CUSIP is the field/column I am trying to analyze.
 
Thank you! 
Shayla 
  • Hi !

    Sorry, you need to remove, the enclosed single quotes from column name;

    =IF(LEFT('vBI_ClientBankAccounts'[Bank Account CUSIP],2)= "CD", "CD", IF(LEFT('vBI_ClientBankAccounts'[Bank Account CUSIP],3)= "TBS", "TBS", "AMMA"))

     

    Hopefully above DAX will work.

4 Replies

  • Hi !

    Please try using below DAX, enclosed table name in single quote;

     

    =IF(LEFT('vBI_ClientBankAccounts'['Bank Account CUSIP'],2)= "CD", "CD", IF(LEFT('vBI_ClientBankAccounts'['Bank Account CUSIP'],3)= "TBS", "TBS", "AMMA"))

     
    Regards,

    Hasham

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Hasham - thanks for getting back to me. I tried this: 

      =IF(LEFT('vBI_ClientBankAccounts'['Bank Account CUSIP'],2)= "CD", "CD", IF(LEFT('vBI_ClientBankAccounts'['Bank Account CUSIP'],3)= "TBS", "TBS", "AMMA"))
       
      Now I get this error with the red squiggly lines below the fields:
       
      • HashamNiaz's avatar
        HashamNiaz
        Solution Sage

        Hi !

        Sorry, you need to remove, the enclosed single quotes from column name;

        =IF(LEFT('vBI_ClientBankAccounts'[Bank Account CUSIP],2)= "CD", "CD", IF(LEFT('vBI_ClientBankAccounts'[Bank Account CUSIP],3)= "TBS", "TBS", "AMMA"))

         

        Hopefully above DAX will work.