Wednesday, June 21, 2023

Explain the String Function ' PROPER ' in Tableau with Example?

 In Tableau, the PROPER function is used to convert a string to title case, where the first letter of each word is capitalized, and all other letters are lowercase. It is commonly used to standardize the capitalization of names or textual data in Tableau visualizations and calculations.


The syntax for the PROPER function in Tableau is as follows:


PROPER(string)

string is the text or string field that you want to convert to title case.


Here's an example to illustrate the usage of the PROPER function in Tableau:


Let's consider a dataset with a column called "Customer Name" that contains customer names in various formats and capitalization styles.


Customer Name

john doe

MARY SMITH

Peter Parker

jessica JONES


To convert the customer names to title case using the PROPER function, you can create a calculated field in Tableau:


  • Right-click on a blank area in the "Data" pane in Tableau.
  • Select "Create Calculated Field."
  • In the formula editor, enter the following expression:

            PROPER([Customer Name])

  • Click "OK" to create the calculated field.


The calculated field, which utilizes the PROPER function, will convert the customer names to title case, where the first letter of each word is capitalized and all other letters are lowercase.


The resulting dataset will be as follows:


Customer Name                                         Proper Name

john doe                                                         John Doe

MARY SMITH                                         Mary Smith

Peter Parker                                                 Peter Parker

jessica JONES                                         Jessica Jones


As shown in the example, the PROPER function capitalizes the first letter of each word in the "Customer Name" column and converts the remaining letters to lowercase. The resulting column, named "Proper Name," contains the names in title case format.


By using the PROPER function, you can ensure consistent capitalization and improve the readability of textual data in your Tableau visualizations and analyses.

No comments:

Post a Comment

If you have any doubts. Please let me know

How can you create an alias for a table in a SQL query?

In SQL, you can create an alias for a table in a query to give the table a temporary, alternative name that you can use in the query. Table ...